This tutorial will describe how to use palettes and specify element and series colors as well as some more advanced coloring features.
There are several 50 color palettes and over 40 5 color palettes available in the Palette enumeration. These can be defined in two ways.
A: Through Chart.PaletteName:
Chart.PaletteName = dotnetCHARTING.Palette.Autumn;
Chart.PaletteName = dotnetCHARTING.Palette.Autumn
This code will color each series based on a color in this palette.
B: Through Series.PaletteName
mySeries.PaletteName = dotnetCHARTING.Palette.Autumn;
mySeries.PaletteName = dotnetCHARTING.Palette.Autumn
Using palette properties of series will color each element in that series a unique color of the specified palette as well as alter the legend behavior.
|NOTE: (Important) By specifying a series palette, the legend box will display an entry for each element instead of entries for each series.|
There are a number of five color palettes available in the Palette enumeration. These palettes can be combined to form a palette with a larger set of colors using the Chart.PaletteAdd() method.
Coloring Individual Elements
To specify a color for an individual element it needs to be set through the Element.Color property. To specify a color for an entire series of elements, set the Series.DefaultElement.Color property.
|In order to specify individual series or element colors, a populated Series or SeriesCollection is required. Please see this kb for more information.|
Financial series types like candlestick and bar use Element.SecondaryColor to fill elements that have a lower close price than open price.
A 2D line's thickness, and style can be controlled with the Series.Line property however, the line color is based on individual element colors.
More advanced coloring options are described in the SmartColor & SmartPalette Tutorial.