0
votes

I'm using Delphi and Fast reports, specifically the TeeChart object inside Fast Reports. I'm trying to plot a scatter graph (preferably with a line between the points) Four points of typical X,Y data might look like this

  • X=10, Y=35
  • X=15, Y=40
  • X=23, Y=44
  • X=27, Y=8

I've set the X axis automatic to false and set a min of 0 and a max of 30.

However, when Teechart plots the points it plots the Y values at the correct height but puts them in X positions 0, 1, 2, 3 instead of 10, 15, 23, 27

This even happens when I hard code the data by setting 'Data Source' to 'Fixed Data' and putting 35;40;44;8 in the Y values box and 10;15;23;27 in the X values box.

How do I set up Teechart to plot the points at the correct X-Y coordinates?

1
How do you provide data for line series? AddXY?MBo
Within Fast Reports its done by pointing the X and Y of the chart to the relevant fields in the dataset containing the data you want to plot. However you can also 'hard code' it as I mentioned above by typing the data values directly into the X and Y edit boxes of the chart object at design time. That's what I did to test it to make sure it wasn't anything in the dataset causing the issue. But with the values above they are still plotted in X positions 0, 1, 2 and 3.user3209752

1 Answers

2
votes

You should use AddXY method, for example:

  Series1.AddXY(10, 35);
  Series1.AddXY(15, 40);
  Series1.AddXY(23, 44);
  Series1.AddXY(27, 8);

You should also be able to modify values like this:

  Chart1[0].XValues[0]:=10;
  Chart1[0].XValues[1]:=15;
  Chart1[0].XValues[2]:=23;
  Chart1[0].XValues[3]:=27;
  Chart1[0].XValues[0]:=35;
  Chart1[0].XValues[1]:=40;
  Chart1[0].XValues[2]:=44;
  Chart1[0].XValues[3]:=8;

That's how it should be done in TeeChart outside of FastReports. If none of those solutions works you might need to contact FastReports technical support.