Nevron Open Vision Documentation
Chart / Charts / Palettes
In This Topic
    Palettes
    In This Topic

    Several objects in the chart and gauge have an associated palette object. These include the bar series, area series, high low series, heat map series, tree map chart, linear and radial range indicators. The palette object purpose is to map a value to a color in order to increase readability.

    There are several palette objects that derive from the NPalette base class which are discussed in this topic.

     Two Color Palette

    The two color palette maps a range of values to a begin and end color. Optionally values between the begin / end of the range are interpolated between the begin and end color. The two color palette is represented by the NTwoColorPalette  class. The following code shows how to create such a palette:

    C#
    Copy Code

    someObject.Palette = new NTwoColorPalette(NColor.Red, NColor.Green);

     Three Color Palette

    The three color palette maps a range of values to colors using a set of three colors and origin value. This is done using to the following rules:

    1. If both the begin and end values of the range are less than the orgin value the begin value is mapped to the begin color and the end value is mapped to the interpolated color between the begin color and the origin color.

    2. If the begin value is less than the origin value and the end value is bigger than the origin value then the begin value is mapped to the begin color, the origin value is mapped to the origin color and the end value is mapped to the end color.

    3. If both the begin and end values of the range are bigger than the origin value then the begin value is mapped to the interpolated color between the origin color and the end color and the end value is mapped to the end color.

    This type of palette is generally used in charts that need a color for positive and negative changes (for example tree map charts).

    The following code snippet shows how to create a three color palette:

    C#
    Copy Code

    someObject.Palette = new NThreeColorPalette(NColor.Red, NColor.Green, NColor.White, 0);

    This palette will color negative values in red and positive values in green.
     Color Value Palette

    The color value palette maps a set of values to a set of colors. The following code snippet shows how to create this type of palette:

    C#
    Copy Code

    someObject.Palette = new NColorValuePalette(new NColorValuePair[] { new NColorValuePair(0.0, NColor.Purple),
    new NColorValuePair(1.5, NColor.MediumSlateBlue),
    new NColorValuePair(3.0, NColor.CornflowerBlue),
    new NColorValuePair(4.5, NColor.LimeGreen),
    new NColorValuePair(6.0, NColor.LightGreen),
    new NColorValuePair(7.5, NColor.Yellow),
    new NColorValuePair(9.0, NColor.Orange),
    new NColorValuePair(10.5, NColor.Red) });