开发者

C# dashed lines in chart series?

开发者 https://www.devze.com 2023-02-10 13:26 出处:网络
I\'m using the Chart control from .net 4.0 in my C# W开发者_开发知识库inForms app. I have two series\' of data displayed as line graphs.

I'm using the Chart control from .net 4.0 in my C# W开发者_开发知识库inForms app. I have two series' of data displayed as line graphs.

I'm graphing basically a supply and demand as a function of time. I want the demand to be a solid line of some colour, and the supply to be a dashed line of the same colour.

I can set the colour fine, but I can't find anywhere where I can set the line style to be dashed.


See the DataPointCustomProperties.BorderDashStyle property. For example...

_chart.Series[1].Color = Color.Blue;

_chart.Series[0].Color = Color.Blue;
_chart.Series[0].BorderWidth = 3;
_chart.Series[0].BorderDashStyle = ChartDashStyle.Dash;

...gives me:

C# dashed lines in chart series?


This changes slightly with Visual Studio 2010's version of chart control:

this.chart1.Series["Data1"].BorderDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash;

0

精彩评论

暂无评论...
验证码 换一张
取 消