Page 1 of 1

Chartgrid doesn't change after reloading series.

Posted: Wed Jun 01, 2016 2:31 pm
by 16478246
Hello,
I have a chartgrid connected to a chart. When I show the grid for the first time I only see one line with y values without any x values.
When I use a chart editor connected to the chart and go to the data tab and change any value in the grid then the chartgrid updates to the grid shown in the chart editor.

Another thing that's not working : If I clear the series of the chart en reload them with new values, the chartgrid doesn't change to the new values.
If I use the chart editor again en change a value in the grid then the chartgrid changes also.

How can I solve this strange behaviour.

Regards,

Marcel Horsthuis

Re: Chartgrid doesn't change after reloading series.

Posted: Thu Jun 02, 2016 10:55 am
by yeray
Hello Marcel,
Marcel Horsthuis wrote: I have a chartgrid connected to a chart. When I show the grid for the first time I only see one line with y values without any x values.
You can force the XValues to be shown in the TChartGrid:

Code: Select all

ChartGrid1.ShowXValues:=cgsYes;
Marcel Horsthuis wrote:When I use a chart editor connected to the chart and go to the data tab and change any value in the grid then the chartgrid updates to the grid shown in the chart editor.
Isn't this the behaviour to expect?
Marcel Horsthuis wrote:Another thing that's not working : If I clear the series of the chart en reload them with new values, the chartgrid doesn't change to the new values.
If I use the chart editor again en change a value in the grid then the chartgrid changes also.
I see the ChartGrid isn't updated when I clear the series values or when I add values to the series:

Code: Select all

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

procedure TForm1.Button2Click(Sender: TObject);
var i: Integer;
begin
  for i:=0 to 2 do
    Chart1[0].Add(100 + (random*100));
end;
However, it gets updated if I force it to recalculate its rows&columns with RecalcDimensions:

Code: Select all

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

procedure TForm1.Button2Click(Sender: TObject);
var i: Integer;
begin
  for i:=0 to 2 do
    Chart1[0].Add(100 + (random*100));

  ChartGrid1.RecalcDimensions;
end;

Re: Chartgrid doesn't change after reloading series.

Posted: Tue Jun 07, 2016 9:03 am
by 16478246
Hello Yeray

Thank you for your solution It works!
I couldn't find it in the documentation. :wink:

Marcel