Skip to main content

Segment Colorizers

  • 5 minutes to read

Segment Colorizers allow you to paint segments of the LineSeriesView, AreaSeriesView and their descendants.

Run Demo: Segment Colorizer

Overview

Segment colorizers only paint segments that form a line or area. Use the Series Point Colorizers to paint point markers.

You can use the Segment Colorizers with the following series views:

Follow the steps below to apply a segment colorizer to a series.

Trend Segment Colorizer

The Trend Segment colorizer changes a line/area’s color when a point value increases or decreases. You can specify the colors used to paint increasing and decreasing value segments.

image

The following code shows how to configure and apply the Trend Segment colorizer:

TrendSegmentColorizer colorizer = new TrendSegmentColorizer();
colorizer.FallingTrendColor = Color.RoyalBlue;
colorizer.RisingTrendColor = Color.Firebrick;
colorizer.FallingTrendLegendText = "Temperature Decrease";
colorizer.RisingTrendLegendText = "Temperature Rise";
colorizer.ShowInLegend = true;
LineSeriesView lineSeriesView = chartControl.Series[0].View as LineSeriesView;
lineSeriesView.SegmentColorizer = colorizer;

The following table lists the related API members:

Member Description
TrendSegmentColorizer The colorizer that changes a line‘s color when a point value increases or decreases.
TrendSegmentColorizer.FallingTrendColor Gets or sets the color used to draw the falling value segments.
TrendSegmentColorizer.RisingTrendColor Gets or sets the color used to draw the rising value segments.
TrendSegmentColorizer.FallingTrendLegendText Gets or sets the text the legend uses to identify the falling trend segments.
TrendSegmentColorizer.RisingTrendLegendText Gets or sets the text the legend uses to identify the rising trend segments.
LineSeriesView.SegmentColorizer Gets or sets the colorizer that colors the line view segments.

Range Segment Colorizer

The Range Segment colorizer allows you to paint line/area segments based on their value range.

image

The following code shows how to configure and apply the Range Segment colorizer:

RangeSegmentColorizer colorizer = new RangeSegmentColorizer();
colorizer.RangeStops.AddRange(new double[] { -40, -35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30 });
colorizer.Palette = new Palette("TemperaturePalette", new PaletteEntry[] { new PaletteEntry(Color.DarkBlue),
                                                                           new PaletteEntry(Color.SteelBlue),
                                                                           new PaletteEntry(Color.LightBlue),
                                                                           new PaletteEntry(Color.Yellow),
                                                                           new PaletteEntry(Color.OrangeRed) });
// Alternatively, you can use PaletteName to specify a palette.
// colorizer.PaletteName = Palettes.Slipstream.DisplayName;
colorizer.ShowInLegend = true;
colorizer.LegendItemPattern = "{V1:F0}°C — {V2:F0}°C";
LineSeriesView lineSeriesView = chartControl.Series[0].View as LineSeriesView;
lineSeriesView.SegmentColorizer = colorizer;

The following table lists the related API members:

Member Description
RangeSegmentColorizer The colorizer that allows you to color a line segment based on a its value range.
RangeSegmentColorizer.RangeStops Provides access to the collection of double values that define color range boundaries.
RangeSegmentColorizer.Palette Gets or sets the palette that provides colors for the colorizer.
RangeSegmentColorizer.PaletteName Gets or sets a name of the palette that provides colors for the colorizer.
RangeSegmentColorizer.LegendItemPattern Gets or sets the pattern to format the text the legend shows for a color range.
RangeSegmentColorizer.ShowInLegend Gets or sets the value whether to show the colorizer items in the legend.
LineSeriesView.SegmentColorizer Gets or sets the colorizer that colors the line view segments.

Point Based Segment Colorizer

The Point Based Segment Colorizer paints line/area segments into the point marker colors. Use a series point colorizer or specify the SeriesPoint.Color property directly to provide markers with colors.

image

The following code shows how to configure and apply the Point Based Segment colorizer:

LineSeriesView lineSeriesView = chartControl.Series[0].View as LineSeriesView;
lineSeriesView.MarkerVisibility = DevExpress.Utils.DefaultBoolean.True;

// Specify the colorizer that paints the series markers.
RangeColorizer rangeColorizer = new RangeColorizer();
rangeColorizer.Palette = new Palette("TemperaturePalette", new PaletteEntry[] { new PaletteEntry(Color.DarkBlue),
                                                                                new PaletteEntry(Color.SteelBlue),
                                                                                new PaletteEntry(Color.LightBlue),
                                                                                new PaletteEntry(Color.Yellow),
                                                                                new PaletteEntry(Color.OrangeRed) });

rangeColorizer.LegendItemPattern = "{V1: F0}°C — {V2: F0}°C";
rangeColorizer.RangeStops.AddRange(new double[] { -40, -35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15, 20, 25, 30 });
chartControl.Series[0].Colorizer = rangeColorizer;

// Specify the colorizer that paints the line segments.
PointBasedSegmentColorizer segmentColorizer = new PointBasedSegmentColorizer();
segmentColorizer.Direction = ColorDistributionDirection.Forward;
lineSeriesView.SegmentColorizer = segmentColorizer;

The following table lists the related API members:

Member Description
PointBasedSegmentColorizer The colorizer that uses the point marker colors to paint line/area segments.
PointBasedSegmentColorizer.Direction Gets or sets the direction that is used to distribute the point marker color.
ColorDistributionDirection Lists values that define the direction used by point markers to distribute a color among segments.
LineSeriesView.SegmentColorizer Gets or sets the colorizer that colors the line view segments.
See Also