Charts > Using the Charts Library > Data Display > Customizing Data Display > Defining How the Palettes are Applied for the Data Display
 
Defining How the Palettes are Applied for the Data Display
By default, the palette used by a displayer to display a data point of a data set is determined in the following order:
*The palette stored in the point information object associated with the data point at the level of the displayer is used if such a palette is defined.
*Otherwise, the palette stored in the point information object associated with the data point at the level of the data set is used if such a palette is defined.
*Otherwise, the palette defined for the displayer is used if such a palette is defined.
*Otherwise, the palette defined for the chart using the displayer is used if such a palette is defined.
*Otherwise, the default palette of the display is used.
If a graphical representation by data point for the considered displayer exists, the palette is directly used to draw the graphical representation associated with the data point. This is the case for the displayers displaying markers, bars, and so on. The Boolean value indicating whether there is a graphical representation by data point for a given displayer is returned by the method IlvAbstractChartDisplayer::graphicalRepresentationByDataPoint.
For some displayers (such as polyline displayers, step displayers, and so on) no graphical representation by data point exists. These displayers display a continuous graphical representation linking several data points. For such displayers, the palette is applied by default after the data point. However, it is possible to apply the palette before the data point by calling the method IlvChartGraphic::setApplyPaletteAfterPoint of the chart with IlvFalse as a parameter.
Using the Predefined IlvChartGradientPointInfo Class
You can get the data points to be displayed in color gradations which are computed according to the point value. To do this, you need to build an IlvChartGradientPointInfo with an IlArray of colors and an array of double values. There must be the same number of colors and values. The first value should be the minimum data range and the last one should be the maximum data range.
Example:
IlDouble values[ ] = {0, 50, 100};
IlArray colors;
IlvColor *col = display->getColor(“blue”);
colors.add(col);
col = display->getColor(“white”);
colors.add(col);
col = display->getColor(“red”);
colors.add(col);
 
gradientInfo = new IlvChartGradientPointInfo(values, colors);
The color of each data point which is between 0 and 100 will be computed according to the passed colors. 0 is pure blue, 50 is pure white, 100 is pure red. intermediate values will be displayed in a computed gradient of these colors.

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.