Dynamically add data points to chart

Dynamically add data points to chart

Dynamically add data points to chart

This Delphi graphic tutorial demonstrates how to create a simple charts using TChart component and add data points to the chart at runtime.

DownloadDownload This Tutorials

Bookmark:

Dynamically add data points to chart

Use following simple steps to start your chart using Delphi TChart component:

  • Put chart component on the form
  • Double click on chart, then you will see chart editing dialog box.
  • Click add button in series tab sheet.
  • Select the chart style from the list (Line, Bar, Pie ..)

Dynamically add data points to chart

Use following procedure to add data points into chart at runtime.

procedure TForm1.Button2Click(Sender: TObject);
Var
     X, Y : Variant;
begin
     X := Edit1.Text;
     Y := Edit2.Text;
     Chart1.Series[0].AddXY(X, Y, '', clTeeColor);
end;

This one clears data series from chart.

procedure TForm1.Button1Click(Sender: TObject);
begin
     Chart1.Series[0].Clear;
end;

Download This Delphi Tutorials.

Download materials for this article (Delphi - Tutorials)

Download - add-data-points-to-chart.zipadd-data-points-to-chart.zip
       File size: 8 KB, File type: zip
       Total downloads: 821, Upload date: February 11 - 2009

Leave a comment