Skip to main content

Colorizers

  • 3 minutes to read

Colorizers allow the Sunburst control to automatically color its items. Sunburst provides Palette and Gradient colorizers. These colorizers come with their own options that define how to distribute colors across items in the same group. Items are considered to be a group if they have the common parent item.

This document consists of the following sections.

Overview

Sunburst colorizers inherit the ISunburstColorizer interface. Assign an ISunburstColorizer descendant to the SunburstControl.Colorizer property to specify the sunburst item colorizer.

sunburst-colorizer-properties-window

Colorizers use colors from the palette the SunburstPaletteColorizerBase.Palette property defines. The following table lists the predefined palettes.

BlueGreenPalette

BlueIPalette

BluePalette

blue-green-palette

blue-i-palette

blue-palette

BlueWarmPalette

ChameleonPalette

DXTreeMapPalette

blue-warm-palette

chameleon-palette

dx-tree-map-palette

GreenPalette

GreenYellowPalette

InAFogPalette

green-palette

green-yellow-palette

in-a-fog-palette

MarqueePalette

NatureColorsPalette

NorthernLightsPalette

marquee-palette

nature-colors-palette

northern-lights

OfficePalette

Office2013Palette

Office2016Palette

office-palette

office-2013-palette

office-2016-palette

Office2019Palette

OrangePalette

OrangeRedPalette

office-2019-palette

orange-palette

orange-red-palette

PastelKitPalette

RedOrangePalette

RedPalette

pastel-kit-palette

red-orange-palette

red-palette

RedVioletPalette

SlipstreamPalette

TerracottaPiePalette

red-violet-palette

slipstream-palette

terracote-pie-palette

TheTreesPalette

VioletIPalette

VioletPalette

the-trees-palette

violet-i-palette

violet-palette

YellowOrangePalette

YellowPalette

 

yellow-orange-palette

yellow-palette

 

Use the Palette.CreatePalette method to create a new palette.

The Sunburst control allows you to develop a custom colorizer. Create a class that inherits the ISunburstColorizer interface, and implement its ISunburstColorizer.GetItemColor method.

Palette Colorizer

The Palette Colorizer provides the sunburst’s items with colors using a palette. The SunburstPaletteColorizer class stores Palette Colorizer‘s options.

Use the SunburstPaletteColorizer.VaryColorInGroup property to define how to color items in the same root group. The images below show how VaryColorInGroup operates.

Value Example Description
VaryColorInGroup = false palette-colorizer-vary-color-false Items have an equal color if they belong to the same top-level item.
VaryColorInGroup = true palette-colorizer-colorize-groups-true The first item in a group uses the first color in the palette. Each subsequent item in the group uses the next color in the palette.

The following code shows how to use the Sunburst’s Palette Colorizer.

sunburst.Colorizer = new SunburstPaletteColorizer() {
    VaryColorInGroup = false,
    Palette = Palette.Office2019Palette
};

The example above uses the following API members.

Member Description
SunburstControl.Colorizer Gets or sets the colorizer used to color sunburst items.
SunburstPaletteColorizer The colorizer that colors sunburst items using a palette.
SunburstPaletteColorizer.VaryColorInGroup Specifies whether to color items within one group by the same color.

Gradient Colorizer

The Gradient Colorizer colors sunburst items using gradients. The SunburstGradientColorizer class stores the Gradient Colorizer‘s options. You can use the SunburstGradientColorizer.Min and SunburstGradientColorizer.Max properties to set the color transparency for items with minimum and maximum values.

The Gradient colorizer’s mode defines how apply a gradient across items.

Mode Example Description
GradientColorizerMode.ByGroupLevel (default) gradient-colorizer-mode-group-level Items have an equal base color if they belong to the same top-level item. A color’s transparency increases from the top-level items to low-level items.
GradientColorizerMode.ByItemIndex gradient-colorizer-mode-by-item-index Items in the same group have an equal base color. A color’s transparency increases with increasing an item index in this group.

The Gradient colorizer allows you to specify SunburstGradientColorizer.GradientColor, which is mixed with each item color.

gradient-colorizer-gradient-color

The following code configures a gradient colorizer and assigns it to a sunburst.

sunburst.Colorizer = new SunburstGradientColorizer {
    Min = 0.6,
    Max = 1,
    Mode = GradientColorizerMode.ByGroupLevel,
    GradientColor = Color.Black
};

The table below lists the API member the code above uses.

Member Description
SunburstControl.Colorizer Gets or sets the colorizer used to color sunburst items.
SunburstGradientColorizer The colorizer that colors sunburst items using gradients.
SunburstGradientColorizer.Min Specifies the color transparency of an item with the minimum value (should be in the [0,1] range).
SunburstGradientColorizer.Max Specifies the color transparency of an item with the maximum value (should be in the [0,1] range).
SunburstGradientColorizer.Mode Specifies how to distribute a gradient across items.
GradientColorizerMode Lists gradient distribution modes.
SunburstGradientColorizer.GradientColor Gets or sets the color that is blended with an item’s color.