Have a custom palette to be applied to the chart

Applies to: Nevron Chart for .NET

How to have a custom palette to be applied to the chart?

You can set a custom palette in order to have different colors applied to your charts. You need to apply a fill style to each individual data point that you wish to be colored in a different way that the standard fill style associated with the series. For example:

NChart chart = nChartControl1.Charts[0];
NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar);
bar.FillStyles[0] = new NColorFillStyle(Color.Red);
bar.FillStyles[1] = new NColorFillStyle(Color.Green);
bar.FillStyles[2] = new NColorFillStyle(Color.Blue);

Dim chart As NChart = nChartControl1.Charts(0)
Dim bar As NBarSeries = DirectCast(chart.Series.Add(SeriesType.Bar), NBarSeries)
bar.FillStyles(0) = New NColorFillStyle(Color.Red)
bar.FillStyles(1) = New NColorFillStyle(Color.Green)
bar.FillStyles(2) = New NColorFillStyle(Color.Blue)

The above code will associate red, green and blue fill style to the first, second and third data point in a simple bar chart.

You can also use the built in Chart Editor and the predefined palettes.

Article ID: 69, Created On: 10/6/2010, Modified: 11/15/2010