3

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

razlebe
  • 7,134
  • 6
  • 42
  • 57
C-sharing-guy
  • 61
  • 2
  • 3

3 Answers3

5
Chart1.Series["MySeries"].Color = System.Drawing.Color.FromArgb(113, 152, 203);
Geoff
  • 9,340
  • 7
  • 38
  • 48
0

If you are more used to hex colors:

chart1.Series["MySeries"].Color = System.Drawing.ColorTranslator.FromHtml("#001122");
miky
  • 449
  • 6
  • 20
0

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

Chart1.SeriesCollection(1).Border.Color = Color.Orange;
Machavity
  • 30,841
  • 27
  • 92
  • 100