Skip to main content

RangeSegmentColorizer Class

The colorizer that allows you to color a line segment based on a its value range.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.1.dll

NuGet Package: DevExpress.Charts

Declaration

[TypeConverter(typeof(RangeSegmentColorizerTypeConverter))]
public class RangeSegmentColorizer :
    SegmentColorizerBase,
    IRangeSegmentColorizer,
    IPaletteProvider,
    IPaletteRepositoryHolder,
    ISupportPropertyChanged,
    ILegendItemProvider,
    IPatternHolder

Remarks

You can use the RangeSegmentColorizer to color the line series view and its descendants. To do this, assign the RangeSegmentColorizer object to the LineSeriesView.SegmentColorizer property.

Use the following properties to configure the RangeSegmentColorizer:

  • The RangeStops contains numerical values on which a color should change.
  • Use the Palette and PaletteName properties to specify a palette that stores colors for the colorizer. You can use the built-in palettes that the Palettes class stores.
  • The LegendItemPattern property allows you to format a text the legend shows for each color range. Note the ShowInLegend property should be enabled.

Example

This example demonstrates how to use the RangeSegmentColorizer to color a line series by its segments.

Follow the steps below to configure the RangeSegmentColorizer object and apply it to a line series view:

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;

Implements

Inheritance

See Also