Bug in Zoom with TPointSeries
Bug in Zoom with TPointSeries
Hi,
I have this bug since forever but now I can reproduce it for you. I have this issue almost every time I zoom all kind of charts I have with one TPointSeries in them (no more series), and It turns out that if I add points with AddXY instead of using DynamicArrays, this issue is not present. The bad thing is that AddXY is wayyyy slower than using DynamicArray, so not suitable for my charts (a lot of thousands of points). What is the internal difference between those two options to add points to series???
In the uploaded project, data used is loaded from the file chart.tee; there's one button for loading data using DynamicArray and another using AddXY. You may check the issue doing zoom in almost every zone of the chart, but I usually do it over the four points around coordinates (-2.3, 0.6).
I'm using TeeChart Pro v7.12 Win32 and CodeGear™ C++Builder® 2007.
Thanks!
I have this bug since forever but now I can reproduce it for you. I have this issue almost every time I zoom all kind of charts I have with one TPointSeries in them (no more series), and It turns out that if I add points with AddXY instead of using DynamicArrays, this issue is not present. The bad thing is that AddXY is wayyyy slower than using DynamicArray, so not suitable for my charts (a lot of thousands of points). What is the internal difference between those two options to add points to series???
In the uploaded project, data used is loaded from the file chart.tee; there's one button for loading data using DynamicArray and another using AddXY. You may check the issue doing zoom in almost every zone of the chart, but I usually do it over the four points around coordinates (-2.3, 0.6).
I'm using TeeChart Pro v7.12 Win32 and CodeGear™ C++Builder® 2007.
Thanks!
- Attachments
-
- ZoomPointSeriesIssue.rar
- (346.34 KiB) Downloaded 820 times
Re: Bug in Zoom with TPointSeries
Hi beetle,
Have you seen the Real-time Charting article? Maybe you can still improve your chart optimization a little bit with some of the tips explained there.
The AddXY method makes some internal verifications and that's why it could result in a little lag. I think you could improve the AddXY way disabling AutoRepaint before a the AddXY iteration and enable it after the addition.
Finally, I've been testing your application, and the problem seems to be the XValues Order. If you set the following, using DynamicArrays seems to zoom fine:
Have you seen the Real-time Charting article? Maybe you can still improve your chart optimization a little bit with some of the tips explained there.
The AddXY method makes some internal verifications and that's why it could result in a little lag. I think you could improve the AddXY way disabling AutoRepaint before a the AddXY iteration and enable it after the addition.
Finally, I've been testing your application, and the problem seems to be the XValues Order. If you set the following, using DynamicArrays seems to zoom fine:
Code: Select all
series->XValues->Order = loNone;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Bug in Zoom with TPointSeries
Hi Yeray!
Yes, I follow the tips of your real-time charting article since several years ago and they are a great improvement. Anyway, there's a huge speed difference between AddXY and DynamicArray in spite of disabling AutoRepaint (or the Series->BeginUpdate thing). The good news is that the zoom bug we are talking about is fixed with your workaround, altough zoom speed has decreased way down . Zoom speed is the same for an area with 1 point than for an area with all points. If you think of another way to increase zoom speed again, it would be appreciated
Thanx!
Yes, I follow the tips of your real-time charting article since several years ago and they are a great improvement. Anyway, there's a huge speed difference between AddXY and DynamicArray in spite of disabling AutoRepaint (or the Series->BeginUpdate thing). The good news is that the zoom bug we are talking about is fixed with your workaround, altough zoom speed has decreased way down . Zoom speed is the same for an area with 1 point than for an area with all points. If you think of another way to increase zoom speed again, it would be appreciated
Thanx!
Re: Bug in Zoom with TPointSeries
Hi beetle,
With your application, I can't see any difference in Zoom speed. Could you please send us another simple example project we can run as-is here to reproduce this here?
With your application, I can't see any difference in Zoom speed. Could you please send us another simple example project we can run as-is here to reproduce this here?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Bug in Zoom with TPointSeries
Hi Yeray,
yes, I can see speed differences in that application but maybe your computer is quite better than mine, so you have to use more points. You can change the line:
for this code:
You can use another number of samples depending on the speed of your computer but I wouldn't click on the "AddXY" button because it takes like forever to add all the points Besides, the zoom issue just appears using DynamicArray to load points.
I hope you can see it now.
Thanks!
yes, I can see speed differences in that application but maybe your computer is quite better than mine, so you have to use more points. You can change the line:
Code: Select all
LoadChartFromFile((TCustomChart*)Chart1, "chart.tee");
Code: Select all
TPointSeries* series = new TPointSeries(Chart1);
Chart1->AddSeries(series);
series->FillSampleValues(300000);
I hope you can see it now.
Thanks!
Re: Bug in Zoom with TPointSeries
Hi beetle,
Yes, the problem is that with this amount of points, each repaint takes a while. With FastLine series there is the DrawAllPoints property probably would help you to increase the draw speed. But with a PointSeries I'm afraid that I only can think on, if the lag is important maybe you should consider removing your series data, create a temporal array that contains only the values that will be shown in the zoomed area, and reassign the values arrays.
Yes, the problem is that with this amount of points, each repaint takes a while. With FastLine series there is the DrawAllPoints property probably would help you to increase the draw speed. But with a PointSeries I'm afraid that I only can think on, if the lag is important maybe you should consider removing your series data, create a temporal array that contains only the values that will be shown in the zoomed area, and reassign the values arrays.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Bug in Zoom with TPointSeries
Hi Yeray,
thanks anyway, the important thing is there's no bug anymore, in spite of losing speed while zooming. I'll get a more powerful PC so far, but you should consider to improve this kind of speed issues in series with Pointer (TLineSeries, TPointSeries). Besides, I suggest another way to manage pointer styles for all points, different from the OnGetPointerStyle event (now issues one function call per point), and maybe add the same behaviour as in DrawAllPoints=false in TFastLineSeries. Those just are some hints coming off my mind
Thanks.
thanks anyway, the important thing is there's no bug anymore, in spite of losing speed while zooming. I'll get a more powerful PC so far, but you should consider to improve this kind of speed issues in series with Pointer (TLineSeries, TPointSeries). Besides, I suggest another way to manage pointer styles for all points, different from the OnGetPointerStyle event (now issues one function call per point), and maybe add the same behaviour as in DrawAllPoints=false in TFastLineSeries. Those just are some hints coming off my mind
Thanks.
Re: Bug in Zoom with TPointSeries
Hi beetle,
Of course, we will try to improve Point and Line series with tips like those you suggested but, as you understand, drawing a huge amount of points will always be delicate.
Of course, we will try to improve Point and Line series with tips like those you suggested but, as you understand, drawing a huge amount of points will always be delicate.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Bug in Zoom with TPointSeries
Hi,
I've been working in speed improvement with TPointerSeries and now I can work with several million points 10-15 times faster. To do so, I've implemented my own class derived from TPointerSeries and reimplemented 2 functions only, but the most important thing I did is preprocessing to choose which points have to be drawn, and issued every Pointer->DrawPointer call in the OnAfterDraw handler. I believe this preprocessing thing is something similar to your "TFastLineSeries::DrawAllValues=false" behaviour.
Besides, with this new implementation, there's no need to put "series->XValues->Order = loNone;" to avoid the zoom issue of this topic and thus Zoom is really fast again.
I did the same with TLineSeries and I've doubled speed whether Pointer is visible but I could get more speed if I do the same for the line points, so I need to know where in the source code line drawing is done for every series points.
Thanks.
I've been working in speed improvement with TPointerSeries and now I can work with several million points 10-15 times faster. To do so, I've implemented my own class derived from TPointerSeries and reimplemented 2 functions only, but the most important thing I did is preprocessing to choose which points have to be drawn, and issued every Pointer->DrawPointer call in the OnAfterDraw handler. I believe this preprocessing thing is something similar to your "TFastLineSeries::DrawAllValues=false" behaviour.
Besides, with this new implementation, there's no need to put "series->XValues->Order = loNone;" to avoid the zoom issue of this topic and thus Zoom is really fast again.
I did the same with TLineSeries and I've doubled speed whether Pointer is visible but I could get more speed if I do the same for the line points, so I need to know where in the source code line drawing is done for every series points.
Thanks.
Re: Bug in Zoom with TPointSeries
Hi beetle,
1. I'm happy to see that you are achieving satisfactory results with TeeChart now! Even if you had to modify its source a little bit...
2. Yes, to see how Lines are drawn take a look at the method:
You should find it at Series.pas file, TCustomSeries class.
1. I'm happy to see that you are achieving satisfactory results with TeeChart now! Even if you had to modify its source a little bit...
2. Yes, to see how Lines are drawn take a look at the method:
Code: Select all
procedure TCustomSeries.DrawValue(ValueIndex:Integer);
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Bug in Zoom with TPointSeries
Hi Yeray,
I got this too. You just may derive from TLineSeries and override the DrawValue method like this:
where "toleranceY" is the y gap threshold for which several points of same x coordinate (in pixels) are drawn. TFastLineSeries with the property "DrawAllPoints=false" doesn't draw more than one point with the same x coordinate (in pixels), regardless of y coordinate, (that is, toleranceY tends to infinite), so you could be missing important series peeks.
Thanks.
I got this too. You just may derive from TLineSeries and override the DrawValue method like this:
Code: Select all
void __fastcall TISALineSeries::DrawValue(int ValueIndex)
{
x=GetHorizAxis->CalcXPosValue(XValues->Value[ValueIndex]); // x coordinate for ValueIndex
y=GetVertAxis->CalcYPosValue(YValues->Value[ValueIndex]); // y coordinate for ValueIndex
if(x == oldx) // Skip "redundant" points
if(abs(y - oldy) < toleranceY) // I take a 5% tolerance of its Vertical Axis Height, that is (GetVertAxis->IEndPos - GetVertAxis->IStartPos)*0.05
return;
oldx = x;
oldy = y;
TLineSeries::DrawValue(ValueIndex);
Thanks.
Re: Bug in Zoom with TPointSeries
Hi beetle,
In v9 it will be possible to combine DrawAllPoints:=false with a new property DrawAllPointsStyle:=daMinMax that should show those peeks for FastLineSeries.
In v9 it will be possible to combine DrawAllPoints:=false with a new property DrawAllPointsStyle:=daMinMax that should show those peeks for FastLineSeries.
Code: Select all
series1.DrawAllPoints := false;
series1.DrawAllPointsStyle := daMinMax;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |