TdxChartCustomDiagram.OnGetSeriesPointDrawParameters Event
Allows you to customize the appearance of individual series points.
Declaration
property OnGetSeriesPointDrawParameters: TdxChartGetSeriesPointDrawParametersEvent read; write;
Remarks
You can handle OnGetSeriesPointDrawParameters
and OnGetValueLabelDrawParameters events to customize individual series points and their value labels based on certain conditions.
Event Occurrence
The OnGetSeriesPointDrawParameters
event occurs every time the diagram is about to determine how to draw a series point.
Event Parameters
The following parameters are available within an OnGetSeriesPointDrawParameters
event handler:
Sender
- This parameter provides access to the diagram that raised the appearance customization event.
AArgs
- This parameter allows you to identify the processed series point and customize its appearance settings.
Refer to the TdxChartGetSeriesPointDrawParametersEvent procedural type description for detailed information on all available options.
Code Examples
Simple Area View
The following code example demonstrates a diagram’s OnGetSeriesPointDrawParameters
event handler that changes the appearance settings of points with peak values in a Simple Area series:
procedure TMyForm.cdAreaGetSeriesPointDrawParameters(Sender: TdxChartCustomDiagram;
AArgs: TdxChartGetSeriesPointDrawParametersEventArgs);
var
AAreaDrawParameters: TdxChartAreaSeriesPointDrawParameters;
ASeries: TdxChartCustomSeries;
AIndex: Integer;
begin
if AArgs.SeriesPoint.Series.Caption = 'DevAV South' then
begin
if AArgs.DrawParameters.ClassType <> TdxChartAreaSeriesPointDrawParameters then Exit;
AAreaDrawParameters := AArgs.DrawParameters as TdxChartAreaSeriesPointDrawParameters;
AIndex := AArgs.SeriesPoint.Index;
ASeries := AArgs.SeriesPoint.Series;
if ((AIndex = 0) and (ASeries.Points.Values[AIndex] > ASeries.Points.Values[AIndex + 1])) or
((AIndex > 0) and (AIndex < ASeries.Points.Count - 1) and
(ASeries.Points.Values[AIndex] > ASeries.Points.Values[AIndex + 1]) and
(ASeries.Points.Values[AIndex] > ASeries.Points.Values[AIndex - 1])) then
begin
AAreaDrawParameters.MarkerAppearance.FillOptions.Color := TdxAlphaColors.Red;
AAreaDrawParameters.Appearance.BeginUpdate;
AAreaDrawParameters.Appearance.FillOptions.Color := TdxAlphaColors.OrangeRed;
AAreaDrawParameters.Appearance.FillOptions.Mode := TdxFillOptionsMode.Hatch;
AAreaDrawParameters.Appearance.FillOptions.HatchStyle := TdxFillOptionsHatchStyle.ForwardDiagonal;
AAreaDrawParameters.Appearance.FillOptions.Color2 := TdxAlphaColors.Teal;
AAreaDrawParameters.Appearance.StrokeOptions.Color := TdxAlphaColors.Red;
AAreaDrawParameters.Appearance.StrokeOptions.Style := TdxStrokeStyle.Solid;
AAreaDrawParameters.Appearance.EndUpdate;
end;
end;
end;
Simple Bar View
The following code example demonstrates a diagram’s OnGetSeriesPointDrawParameters
event handler that changes the appearance settings of all bars that display peak values in a Simple Bar series.
procedure TMyForm.cdBarGetSeriesPointDrawParameters(Sender: TdxChartCustomDiagram;
AArgs: TdxChartGetSeriesPointDrawParametersEventArgs);
var
ABarDrawParameters: TdxChartBarSeriesPointDrawParameters;
ASeries: TdxChartCustomSeries;
AIndex: Integer;
begin
if AArgs.SeriesPoint.Series.Caption = '2020' then
begin
if AArgs.DrawParameters.ClassType <> TdxChartBarSeriesPointDrawParameters then Exit;
ABarDrawParameters := AArgs.DrawParameters as TdxChartBarSeriesPointDrawParameters;
AIndex := AArgs.SeriesPoint.Index;
ASeries := AArgs.SeriesPoint.Series;
if ((AIndex = 0) and (ASeries.Points.Values[AIndex] > ASeries.Points.Values[AIndex + 1])) or
((AIndex > 0) and (AIndex < ASeries.Points.Count - 1) and
(ASeries.Points.Values[AIndex] > ASeries.Points.Values[AIndex + 1]) and
(ASeries.Points.Values[AIndex] > ASeries.Points.Values[AIndex - 1])) then
begin
ABarDrawParameters.Appearance.BeginUpdate;
ABarDrawParameters.Appearance.FillOptions.Color := TdxAlphaColors.OrangeRed;
ABarDrawParameters.Appearance.FillOptions.Mode := TdxFillOptionsMode.Hatch;
ABarDrawParameters.Appearance.FillOptions.HatchStyle := TdxFillOptionsHatchStyle.ForwardDiagonal;
ABarDrawParameters.Appearance.FillOptions.Color2 := TdxAlphaColors.Teal;
ABarDrawParameters.Appearance.StrokeOptions.Color := TdxAlphaColors.Red;
ABarDrawParameters.Appearance.StrokeOptions.Style := TdxStrokeStyle.Solid;
ABarDrawParameters.Appearance.EndUpdate;
end;
end;
end;
Simple Line View
The following code example demonstrates a diagram’s OnGetSeriesPointDrawParameters
event handler that changes the appearance settings of points with peak values in a Simple Line series.
procedure TMyForm.cdLineGetSeriesPointDrawParameters(Sender: TdxChartCustomDiagram;
AArgs: TdxChartGetSeriesPointDrawParametersEventArgs);
var
ALineDrawParameters: TdxChartLineSeriesPointDrawParameters;
ASeries: TdxChartCustomSeries;
AIndex: Integer;
begin
if AArgs.SeriesPoint.Series.Caption = 'Europe' then
begin
if AArgs.DrawParameters.ClassType <> TdxChartLineSeriesPointDrawParameters then Exit;
ALineDrawParameters := AArgs.DrawParameters as TdxChartLineSeriesPointDrawParameters;
AIndex := AArgs.SeriesPoint.Index;
ASeries := AArgs.SeriesPoint.Series;
if ((AIndex = 0) and (ASeries.Points.Values[AIndex] > ASeries.Points.Values[AIndex + 1])) or
((AIndex > 0) and (AIndex < ASeries.Points.Count - 1) and
(ASeries.Points.Values[AIndex] > ASeries.Points.Values[AIndex + 1]) and
(ASeries.Points.Values[AIndex] > ASeries.Points.Values[AIndex - 1])) then
begin
ALineDrawParameters.MarkerAppearance.FillOptions.Color := TdxAlphaColors.Red;
ALineDrawParameters.Appearance.BeginUpdate;
ALineDrawParameters.Appearance.StrokeOptions.Color := TdxAlphaColors.Red;
ALineDrawParameters.Appearance.StrokeOptions.Style := TdxStrokeStyle.Solid;
ALineDrawParameters.Appearance.EndUpdate;
end;
end;
end;
Pie View
The following code example demonstrates a diagram’s OnGetSeriesPointDrawParameters
event handler that changes the appearance settings of the pie slice that shows the English language’s share:
procedure TMyForm.cdAreaGetSeriesPointDrawParameters(Sender: TdxChartCustomDiagram;
AArgs: TdxChartGetSeriesPointDrawParametersEventArgs);
var
ASimpleDrawParameters: TdxChartSimpleSeriesPointDrawParameters;
begin
if AArgs.SeriesPoint.Argument = 'English' then
begin
if AArgs.DrawParameters.ClassType <> TdxChartSimpleSeriesPointDrawParameters then Exit;
ASimpleDrawParameters := AArgs.DrawParameters as TdxChartSimpleSeriesPointDrawParameters;
ASimpleDrawParameters.FillOptions.BeginUpdate;
ASimpleDrawParameters.FillOptions.Color := TdxAlphaColors.LightCyan;
ASimpleDrawParameters.FillOptions.Color2 := TdxAlphaColors.LightBlue;
ASimpleDrawParameters.FillOptions.Mode := TdxFillOptionsMode.Hatch;
ASimpleDrawParameters.FillOptions.HatchStyle := TdxFillOptionsHatchStyle.ForwardDiagonal;
ASimpleDrawParameters.FillOptions.EndUpdate;
end;
end;