Difference between revisions of "TAChart Runtime FAQ"
From Free Pascal wiki
Jump to navigationJump to search (Add series at runtime) |
(→Series) |
||
Line 1: | Line 1: | ||
This wiki is trying to answer frequently asked questions related to usage of TAChart at runtime | This wiki is trying to answer frequently asked questions related to usage of TAChart at runtime | ||
+ | |||
+ | {{Template:TAChart_Runtime_FAQ}} | ||
== Series == | == Series == |
Revision as of 11:04, 29 January 2018
This wiki is trying to answer frequently asked questions related to usage of TAChart at runtime
Series
How to add a series at runtime?
Just create the series, set its properties and call the chart method AddSeries
uses
TATypes, TASeries;
function AddLineSeries(AChart: TChart; ATitle: String): TChartSeries;
begin
Result := TLineSeries.Create(AChart.Owner);
with TLineSeries(Result) do
begin
// Series title for the legend
SeriesTitle := ATitle;
// Show data point markers (red fill color, black border)
ShowPoints := true;
Pointer.Brush.Color := clRed;
Pointer.Pen.Color := clBlack;
Pointer.Style := psCircle;
// Show red line segments connecting the data points
ShowLines := true;
LinePen.Style := psSolid;
SeriesColor := clRed;
end;
// Add new series to the chart
AChart.AddSeries(Result);
end;