← Back to Index

TFlexFMXCharts

Responsive chart component supporting line, bar, pie, and doughnut charts with animations.

Key Properties

ChartType: TChartType
Type: ctLine, ctBar, ctPie, ctDoughnut, ctArea.
DataSets: TChartDataSets
Collection of data series to display.
Labels: TStringList
X-axis labels or category names.
ShowLegend: Boolean
Display chart legend.
LegendPosition: TLegendPosition
Legend placement: lpTop, lpBottom, lpLeft, lpRight.
ShowGrid: Boolean
Display background grid lines.
Animated: Boolean
Enable entry animations.
AnimationDuration: Single
Animation duration in seconds.
ShowValues: Boolean
Display data values on chart.

DataSet Properties

Label: string
Data series name (shown in legend).
Data: TArray<Single>
Array of numeric values.
Color: TAlphaColor
Series color.
FillColor: TAlphaColor
Fill color (for area charts).

Usage Examples

Line Chart

Chart1.ChartType := ctLine;
Chart1.Labels.Text := 'Jan'#13'Feb'#13'Mar'#13'Apr'#13'May';

with Chart1.DataSets.Add do
begin
  Name := 'Sales';
  Data := [45, 52, 61, 58, 72];
  Color := TAlphaColors.Blue;
end;

Chart1.ShowLegend := True;
Chart1.Animated := True;

Bar Chart (Multiple Series)

Chart1.ChartType := ctBar;
Chart1.Labels.Text := 'Q1'#13'Q2'#13'Q3'#13'Q4';

with Chart1.DataSets.Add do
begin
  Name := '2023';
  Data := [100, 120, 140, 160];
  Color := TAlphaColors.Blue;
end;

with Chart1.DataSets.Add do
begin
  Name := '2024';
  Data := [110, 135, 150, 180];
  Color := TAlphaColors.Green;
end;

Pie Chart

Chart1.ChartType := ctPie;
Chart1.Labels.Text := 'Product A'#13'Product B'#13'Product C';

with Chart1.DataSets.Add do
begin
  Name := 'Market Share';
  Data := [45, 30, 25];
  // Colors assigned automatically or set individually
end;

Chart1.ShowValues := True;

Real-time Update

procedure UpdateChart;
begin
  var NewValue := GetLatestValue;
  Chart1.DataSets[0].Data := Chart1.DataSets[0].Data + [NewValue];
  Chart1.Labels.Add(TimeToStr(Now));
  Chart1.Refresh;
end;

Methods

Events

Notes

← Back to Index