Back to Devexpress

LineSeriesView.SegmentColorizer Property

corelibraries-devexpress-dot-xtracharts-dot-lineseriesview-1210bff8.md

latest6.6 KB
Original Source

LineSeriesView.SegmentColorizer Property

Gets or sets the colorizer that colors the line view segments.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public SegmentColorizerBase SegmentColorizer { get; set; }
vb
<XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)>
Public Property SegmentColorizer As SegmentColorizerBase

Property Value

TypeDescription
SegmentColorizerBase

The SegmentColorizerBase descendant.

|

Remarks

The Chart control provides the following colorizers you can use to color line segments:

Simultaneously, with a segment colorizer, you can use a Point Colorizer to color the line series markers.

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:

csharp
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;
vb
Dim colorizer As RangeSegmentColorizer = 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"
Dim lineSeriesView As LineSeriesView = CType(chartControl.Series(0).View,LineSeriesView)
lineSeriesView.SegmentColorizer = colorizer

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SegmentColorizer 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.

winforms-charts-change-series-line-color-when-value-is-under-predefined-level/CS/Form1.cs#L43

csharp
colorizer.LegendItemPattern = "{V1:0.###} - {V2:0.###}";
    view.SegmentColorizer = colorizer;
}

winforms-charts-change-series-line-color-when-value-is-under-predefined-level/VB/Form1.vb#L48

vb
colorizer.LegendItemPattern = "{V1:0.###} - {V2:0.###}"
    view.SegmentColorizer = colorizer
End Sub

See Also

LineSeriesView Class

LineSeriesView Members

DevExpress.XtraCharts Namespace