Responsive chart component supporting line, bar, pie, and doughnut charts with animations.
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;
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;
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;
procedure UpdateChart; begin var NewValue := GetLatestValue; Chart1.DataSets[0].Data := Chart1.DataSets[0].Data + [NewValue]; Chart1.Labels.Add(TimeToStr(Now)); Chart1.Refresh; end;
Refresh - Redraw chart with current dataClear - Remove all data and labelsExportToBitmap - Get chart as bitmap imageAnimateIn - Replay entry animationOnDataPointClick - User clicks data point (provides Series, Index, Value)OnLegendClick - Legend item clickedOnAnimationComplete - Animation finished