Glossary Item Box

.netCHARTING v3.1 Documentation Send comments on this topic.

Coloring Elements

Introduction

This tutorial will describe how to color different elements and series.

 

Using Palettes

There are several 50 color palettes available in the Palette enumeration. These can be defined in two ways.

Through Chart.PaletteName:

[C#]

Chart.PaletteName = dotnetCHARTING.Palette.Autumn;
[Visual Basic]

Chart.PaletteName = dotnetCHARTING.Palette.Autumn

This code will color each element based on a color in this palette.

Through Series.PaletteName

[C#]

mySeries.PaletteName = dotnetCHARTING.Palette.Autumn;
[Visual Basic]

mySeries.PaletteName = dotnetCHARTING.Palette.Autumn;

Using palette properties of series will color each element in that series a unique color of the specified palette.

By specifying series palettes the legend box will display an entry for each element instead of entries for each series.
 
Sample: features/ColorByElements.aspx

Custom Palettes

Custom palettes can also be specified by supplying Chart.Palette or Series.Palette with an array of color objects. They will work in the same way as pre-defined palettes.

 

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, set Series.DefaultElement.Color.

Samples

  • features/iterateElements.aspx
    Color elements based on value.
  • features/InvisibleLegendEntry.aspx
    Color elements based on value.


SeriesTypeFinancial

Financial series types like candlestick and bar use Element.SecondaryColor to fill elements that have a lower close price than open price.

SeriesType.Line

A 2D line color, thickness, and style can be controlled with the Series.Line property. Each element's color is shown in the element marker. In 3D mode each element section is colored with an elements color.


2002 - 2005 Webavail Productions Inc. & Corporate Web Solutions Ltd.. All Rights Reserved.