RangeSegmentColorizer.LegendItemPattern Property
Gets or sets the pattern to format the text the legend shows for a color range.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
String | A string that is the text pattern. |
Remarks
The RangeSegmentColorizer.RangeStops collection neighbor values form the start and end values for the colorizer legend items.
The LegendItemPattern can contain regular text (displayed as is) and value placeholders in braces. To format numeric values, you can apply Format Specifiers. Use a colon to separate a placeholder and its format specifier.
The following table contains the available placeholders:
Placeholder | Description |
---|---|
{V1} | Displays the start range value. |
{V2} | Displays the end range value. |
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:
Create a RangeSegmentColorizer instance and assign it to the LineSeriesView.SegmentColorizer property.
Populate the RangeSegmentColorizer.RangeStops collection.
Use the RangeSegmentColorizer.Palette property to define a palette.
The
RangeSegmentColorizer.LegendItemPattern
property allows you to specify how to format text the legend shows for each color range.
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;
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the LegendItemPattern property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.