After deleting a data point in a series, and then trying to refresh the chart to update the axis and data points, etc., at the end of the procedure that deletes the data point, the chart will not refresh.
If, however, I issue a refresh through another procedure, say a buttonclick, the chart will refresh.
Is this a bug? How can I workaround?
I am using TeeChart v8.02.10861 Win32 in Delphi 2007 on Windows Vista.
Thanks,
Dennis
Refresh on Tchart doesn't work
Re: Refresh on Tchart doesn't work
Further to my last post....
I guess what I need to know is when is the best 'time' to add data points to a series. As I have a series that is determined by the values of another (source) series, I am calculating the data points (with code) in the 'after draw' event of the source series.
Is this the best 'place'?
I guess what I need to know is when is the best 'time' to add data points to a series. As I have a series that is determined by the values of another (source) series, I am calculating the data points (with code) in the 'after draw' event of the source series.
Is this the best 'place'?
Re: Refresh on Tchart doesn't work
Hi Dennis,
I guess I'm missing something relevant to reproduce the problem, so it would be helpful if you could modify the code below so we can reproduce the problem here. Or please, arrange a simple project for the same purpose.
Note the AfterDraw event can be executed several times, when scrolling, zooming, etc, so the "dependant" series may be refreshed unnecessarily.
Also note you should be careful when calling a refresh function at the AfterDraw event, because you may create an endless loop.
I'm trying to reproduce the situation you describe in a simple example but the following code already refreshes the chart even without calling any "refresh" method (Chart1.Draw, Chart1.Refresh, Chart1[0].Refresh,...).den wrote:After deleting a data point in a series, and then trying to refresh the chart to update the axis and data points, etc., at the end of the procedure that deletes the data point, the chart will not refresh.
If, however, I issue a refresh through another procedure, say a buttonclick, the chart will refresh.
Is this a bug? How can I workaround?
I guess I'm missing something relevant to reproduce the problem, so it would be helpful if you could modify the code below so we can reproduce the problem here. Or please, arrange a simple project for the same purpose.
Code: Select all
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D := false;
Chart1.AddSeries(TPointSeries).FillSampleValues;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Chart1[0].Delete(0);
end;
We'd need some more details on how the data arrives to the "source" series but I'd say the best moment to refresh the "dependant" series is in the same method that captures new data for the "source" series.den wrote:I guess what I need to know is when is the best 'time' to add data points to a series. As I have a series that is determined by the values of another (source) series, I am calculating the data points (with code) in the 'after draw' event of the source series.
Is this the best 'place'?
Note the AfterDraw event can be executed several times, when scrolling, zooming, etc, so the "dependant" series may be refreshed unnecessarily.
Also note you should be careful when calling a refresh function at the AfterDraw event, because you may create an endless loop.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Refresh on Tchart doesn't work
Yeray:
Thanks for your prompt reply to my posting.
You are correct, I was causing an endless loop. I have found a correction for the problem though.
I didn't know the best place (event) to calculate the dependant series. I now calculate the dependant series from the source series data right after the dataset for the source series is activated.
All is well now! (the dependant series now refreshes on its own).
Sorry for 'wasting' your time.
Thanks,
Dennis
Thanks for your prompt reply to my posting.
You are correct, I was causing an endless loop. I have found a correction for the problem though.
I didn't know the best place (event) to calculate the dependant series. I now calculate the dependant series from the source series data right after the dataset for the source series is activated.
All is well now! (the dependant series now refreshes on its own).
Sorry for 'wasting' your time.
Thanks,
Dennis
Re: Refresh on Tchart doesn't work
Hi Dennis,
Glad to be helpful!
Don't hesitate to let us know if you find any other problem with it.
Glad to be helpful!
Don't hesitate to let us know if you find any other problem with it.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |