Chartgrid doesn't change after reloading series.

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Marcel Horsthuis
Newbie
Newbie
Posts: 7
Joined: Tue May 10, 2016 12:00 am

Chartgrid doesn't change after reloading series.

Post by Marcel Horsthuis » Wed Jun 01, 2016 2:31 pm

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

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Chartgrid doesn't change after reloading series.

Post by Yeray » Thu Jun 02, 2016 10:55 am

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;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Marcel Horsthuis
Newbie
Newbie
Posts: 7
Joined: Tue May 10, 2016 12:00 am

Re: Chartgrid doesn't change after reloading series.

Post by Marcel Horsthuis » Tue Jun 07, 2016 9:03 am

Hello Yeray

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

Marcel

Post Reply