سؤال

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.

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top