Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# dashed lines in chart series?

Tags:

c#

charts

mschart

I'm using the Chart control from .net 4.0 in my C# WinForms 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.

like image 961
Ozzah Avatar asked Feb 16 '11 01:02

Ozzah


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

Is C language easy?

Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.

Why is C named so?

Because a and b and c , so it's name is C. C came out of Ken Thompson's Unix project at AT&T. He originally wrote Unix in assembly language. He wrote a language in assembly called B that ran on Unix, and was a subset of an existing language called BCPL.


2 Answers

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:

enter image description here

like image 160
Chris Schmich Avatar answered Sep 25 '22 16:09

Chris Schmich


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

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

like image 33
Kunklemeyer Avatar answered Sep 25 '22 16:09

Kunklemeyer