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.
Colorizers use colors from the palette the SunburstPaletteColorizerBase.Palette property defines. The following table lists the predefined palettes.
BlueGreenPalette | BlueIPalette | BluePalette | |
---|---|---|---|
BlueWarmPalette | ChameleonPalette | DXTreeMapPalette | |
GreenPalette | GreenYellowPalette | InAFogPalette | |
MarqueePalette | NatureColorsPalette | NorthernLightsPalette | |
OfficePalette | Office2013Palette | Office2016Palette | |
Office2019Palette | OrangePalette | OrangeRedPalette | |
PastelKitPalette | RedOrangePalette | RedPalette | |
RedVioletPalette | SlipstreamPalette | TerracottaPiePalette | |
TheTreesPalette | VioletIPalette | VioletPalette | |
YellowOrangePalette | YellowPalette |
| |
|
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 | Items have an equal color if they belong to the same top-level item. | |
VaryColorInGroup = 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) | 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 | 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.
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. |