Multiple y-axis background colors for chart

2019-06-14 13:07发布

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.

1条回答
你好瞎i
2楼-- · 2019-06-14 13:40

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.

查看更多
登录 后发表回答