Series Point Colorizer

  • 3 minutes to read

This topic introduces the Chart Colorizer, lists colorizer types, and explains how to create a colorizer and customize its settings in a chart control.

The topic consists of the following sections.

Overview

The Colorizer is used to automatically choose colors for chart series points. This feature can be applied to the SeriesPoint class. Use the SeriesPoint.Color property to access the calculated colors.

Colorizers allow you to use colors to display additional information about the data.

ChartColorizerExample

Before using this feature, perform the following steps.

  1. Specify the Series.DataSource property and all data member properties required to build a chart.

    You can use colorizers to apply colors to series points based on the data source values. Available colorizers are listed below (see Step 3).

    Series_DataProperties

  2. Use the SeriesBase.ColorDataMember property to specify the data member that stores color values.

    Series_ColorDataMember

  3. Determine the colorizer type to be used in the application.

    Currently, the following types are supported.

    • ColorObjectColorizer applies ColorDataMember values to the SeriesPoint.Color property (if these values have the Color type or a type that can be converted to a color, such as an integer or a string).
    • KeyColorColorizer applies a color based on color data member values used as key values. Series points with equal keys have the same color.
    • RangeColorizer paints points based on the range to which color data member values belong.

After you select a colorizer type, assign an object of the selected type to the SeriesViewBase.Colorizer property. Then, you can customize the colorizer's settings as described in the sections below.

Color Object Colorizer

This colorizer does not have properties that must be specified before you use it. In the following image, each bar is colorized to match the nation's color stored in the data source.

NOTE

This colorizer is used by default.

ColorObjectColorizer

Key-Color Colorizer

To configure the key-color colorizer, perform the following steps.

The following image uses the key-color colorizer to colorize each bar based on a country's region (Africa, America, Asia, etc.).

KeyColorColorizer

Range Colorizer

To configure the range colorizer, perform the following steps.

  • Fill the RangeColorizer.RangeStops collection. These values form ranges that are used to determine the color a series point.

    RangeColorizer_RangeStops

  • If you wish to use a custom palette to colorize your data, specify the ChartPaletteColorizerBase.Palette property.

    RangeColorizer_Palette

    PaletteEditor

  • In addition, you can set the RangeColorizer.ValueProvider property to specify numeric values that the RangeColorizer uses to determine point colors.

    NOTE

    This property can be changed only in code.

The following image uses the range colorizer to apply a color to each bar based on the Happy Planet Index.

RangeColorizer