CustomDrawSeriesPointEventArgs.SeriesPoint Property
Gets the series point currently being painted.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v24.2.dll
NuGet Package: DevExpress.Charts
#Declaration
public SeriesPoint SeriesPoint { get; }
#Property Value
Type | Description |
---|---|
Series |
A Series |
#Remarks
Use the SeriesPoint property to access the series point currently being painted when handling the ChartControl.CustomDrawSeriesPoint event.
Important
Changes applied to the object accessed via this property will never be effected.
To change a series point’s appearance in a specific case, use the Custom
#Example
This example demonstrates how to implement custom drawing in charts when drawing the series points of charts. To do this you should handle the ChartControl.CustomDrawSeriesPoint event, and then you can change some of the drawing parameters using its event args.
using DevExpress.XtraCharts;
// ...
private void chartControl1_CustomDrawSeriesPoint(object sender,
CustomDrawSeriesPointEventArgs e) {
// These changes will be applied to Bar Series only.
BarDrawOptions drawOptions = e.SeriesDrawOptions as BarDrawOptions;
if (drawOptions == null)
return;
// Get the fill options for the series point.
drawOptions.FillStyle.FillMode = FillMode.Gradient;
RectangleGradientFillOptions options =
drawOptions.FillStyle.Options as RectangleGradientFillOptions;
if (options == null)
return;
// Get the value at the current series point.
double val = e.SeriesPoint[0];
// If the value is less than 2.5, then fill the bar with green colors.
if (val < 2.5) {
options.Color2 = Color.FromArgb(154, 196, 84);
drawOptions.Color = Color.FromArgb(81, 137, 3);
drawOptions.Border.Color = Color.FromArgb(100, 39, 91, 1);
}
// ... if the value is less than 5.5, then fill the bar with yellow colors.
else if (val < 5.5) {
options.Color2 = Color.FromArgb(254, 233, 124);
drawOptions.Color = Color.FromArgb(249, 170, 15);
drawOptions.Border.Color = Color.FromArgb(60, 165, 73, 5);
}
// ... if the value is greater, then fill the bar with red colors.
else {
options.Color2 = Color.FromArgb(242, 143, 112);
drawOptions.Color = Color.FromArgb(199, 57 ,12);
drawOptions.Border.Color = Color.FromArgb(100, 155, 26, 0);
}
}