C-sharing-guy
C-sharing-guy

Reputation: 61

How do I set the line colour in an MSChart?

I was wondering if someone could please show me sample code for setting the line colour in an MSChart using C#.

I know I can select a scheme form the options but I was wanting to pick my own colours for the different serie's I have shown.

Thank in advance

Upvotes: 3

Views: 8383

Answers (3)

jjmcinto
jjmcinto

Reputation: 1

This answer applies to charts from Microsoft.Office.Interop.Graph.Chart:

Chart1.SeriesCollection(1).Border.Color = Color.Orange;

Upvotes: 0

miky
miky

Reputation: 449

If you are more used to hex colors:

chart1.Series["MySeries"].Color = System.Drawing.ColorTranslator.FromHtml("#001122");

Upvotes: 0

Geoff
Geoff

Reputation: 9340

Chart1.Series["MySeries"].Color = System.Drawing.Color.FromArgb(113, 152, 203);

Upvotes: 5

Related Questions