Question

How can I create a background for a chart that looks like this?

enter image description here

It's got different background colors at certain % levels that correspond to the status. All I see in ChartArea is BackColor, BackSecondaryColor, and BackGradientStyle which won't do this. This image was taken from an SSRS report and I am trying to recreate it using C# and the Microsoft charting library. I am pretty sure SSRS uses the same library so it should be possible - I just don't know how.

Était-ce utile?

La solution

You can achieve this by using StripLine.

// Create the stripline for 'gold status'
StripLine sline = new StripLine();
sline.IntervalOffset = 0.6;
sline.StripWidth = 0.25;
sline.Text = "Gold Status";
sline.Interval = 0.0; // this ensures it will not repeat like normal strip lines
sline.BackColor = Color.Yellow;
myChart.AxisY.StripLines.Add(sline);

repeat the process for your silver and platinum strip lines.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top