TeeChart Speed on IOS

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
rlebbar
Newbie
Newbie
Posts: 18
Joined: Fri Mar 02, 2012 12:00 am

TeeChart Speed on IOS

Post by rlebbar » Wed Mar 14, 2012 11:04 am

Hi Narcis,

I need your help again.
I have read and applied the "Real-time Charting article" and it did not solve the speed problem.
In fact i compared the loading time : "No optimization VS Optimization" the difference in my case is around 10 ms.
Then i noticed that the problem is not at all in loading the data!
In fact i have the feeling that the CPU is tremendously used !.
When i press a button on the same form as the TChart it responds but after a very long period of time : 10 Seconds Just to show a "Hello" message !.
Then, since i can not debug in the Mac side, i tried to debug In windows side ( where there is no speed problem at all !) .
By putting a showmessage on BeforeDraw and on AfterDraw i noticed that drawing keeps get called every time, as soon as you move the mouse, consuming CPU which is ok on windows but not on ios. Please note that no data has been modified or a form resized, just moving the mouse !
I hope that you can find a workaround to not let the TChart be redrawed unnecessarily !

Thanks
r.lebbar

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

Re: TeeChart Speed on IOS

Post by Yeray » Wed Mar 14, 2012 1:02 pm

Hi r.lebbar,
rlebbar wrote:By putting a showmessage on BeforeDraw and on AfterDraw i noticed that drawing keeps get called every time, as soon as you move the mouse, consuming CPU which is ok on windows but not on ios. Please note that no data has been modified or a form resized, just moving the mouse !
I hope that you can find a workaround to not let the TChart be redrawed unnecessarily !
I'm trying to reproduce this in XE2 and the actual sources in a Win7 x64 machine but it seems to work fine for me here. Find attached the application I'm using.
iOS test.zip
(3.62 KiB) Downloaded 1704 times
When the application starts, I see a call to both OnBeforeDrawChart and OnAfterDraw events but not when I move the mouse over the chart once it is shown.
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

rlebbar
Newbie
Newbie
Posts: 18
Joined: Fri Mar 02, 2012 12:00 am

Re: TeeChart Speed on IOS

Post by rlebbar » Wed Mar 14, 2012 2:18 pm

Hi Yeray

Please look at this image !

Thanks
Attachments
Event.png
Your Project
Event.png (163.43 KiB) Viewed 35574 times

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

Re: TeeChart Speed on IOS

Post by Yeray » Wed Mar 14, 2012 2:59 pm

Hi r.lebbar,

This is not just moving the mouse over the chart but pressing the left mouse button down and then moving the mouse to draw the zoom rectangle, isn't it?
To draw the zoom rectangle, the chart has to be redrawn.
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

rlebbar
Newbie
Newbie
Posts: 18
Joined: Fri Mar 02, 2012 12:00 am

Re: TeeChart Speed on IOS

Post by rlebbar » Wed Mar 14, 2012 3:17 pm

Hi Yeray

Sorry Yeray, This is JUST MOVING THE MOUSE over the chart : No Click, No left Button, No Right Button !

Thanks

rlebbar
Newbie
Newbie
Posts: 18
Joined: Fri Mar 02, 2012 12:00 am

Re: TeeChart Speed on IOS

Post by rlebbar » Wed Mar 14, 2012 3:41 pm

Hi Yeray

I have not noticed a rectangle in the back that stays active
Please find the exe i have generated with your code

Thanks
Attachments
iOS test.zip
(3.62 KiB) Downloaded 1604 times

rlebbar
Newbie
Newbie
Posts: 18
Joined: Fri Mar 02, 2012 12:00 am

Re: TeeChart Speed on IOS

Post by rlebbar » Wed Mar 14, 2012 3:48 pm

Hi Yearay

The Exe Project was not allowed to be uploaded.

Thanks

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: TeeChart Speed on IOS

Post by Narcís » Wed Mar 14, 2012 3:50 pm

Hello,

If compressing it in a zip/rar package doesn't fit in the maximum upload size (512 kb) please upload it at http://www.steema.net/upload/.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

rlebbar
Newbie
Newbie
Posts: 18
Joined: Fri Mar 02, 2012 12:00 am

Re: TeeChart Speed on IOS

Post by rlebbar » Wed Mar 14, 2012 3:59 pm

Hi Narcis,

I have uploaded the exe file as indicated.
Please in the mean time what about the ios device, since i am more interested in the ios than the windows projects

Thanks

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

Re: TeeChart Speed on IOS

Post by Yeray » Thu Mar 15, 2012 12:57 pm

Hi r.lebbar,

I'm still a little bit confused.
- The exe you sent us responds to me as I'd expect: before the first time the chart is going to be shows, both events are fired once. Then, once the chart is shown, I can move the window and move the mouse over the chart without clicking on it, and the events aren't fired. Only if I click on the chart, then it is redrawn and the events are fired again and again as I move the mouse because it needs to draw the zoom rectangle.

- In a real device, "moving the mouse over the chart without clicking on it" has no sense (at least I don't see it). So, if you are moving the finger around the chart *touching the chart*, the equivalent in windows would be clicking on the chart and moving the mouse. Then, as said above, by default, a zoom rectangle is being drawn and thus the charts is resized each time a mouse/finger displacement is being detected to draw a new zoom rectangle.

Try disabling the zoom feature:

Code: Select all

Chart1.AllowZoom:=false;
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

rlebbar
Newbie
Newbie
Posts: 18
Joined: Fri Mar 02, 2012 12:00 am

Re: TeeChart Speed on IOS

Post by rlebbar » Sun Mar 18, 2012 11:51 pm

Hi yeray

Sorry for the delay, i was out of town.
Please find a sample that will show you exactly what is happening
In my case then variable "NbreOfTimesTheChartIsDrawn" increments by 5 or 6 at each hit !

Thanks
r.lebbar
Attachments
Test.zip
(4.26 KiB) Downloaded 1567 times

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

Re: TeeChart Speed on IOS

Post by Yeray » Mon Mar 19, 2012 3:36 pm

Hi r.lebbar,

Interesting. If I click on the button with the mouse it behaves as you describe (increments by 5 or 6 at each hit). But if I press the space bar (after one click with the mouse so the focus is in the button), the NbreOfTimesTheChartIsDrawn remains stable.
And the same happens if I use the chart Clicked event:

Code: Select all

procedure TForm1.Chart1Click(Sender: TObject);
begin
  ShowMessageFmt('So far, the Chart has been drawn %d Times',[NbreOfTimesTheChartIsDrawn]);
end;
Could you please confirm with this the number of times the chart is drawn seems to be stable?
It would indicate that clicking the button makes the chart to be redrawn
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

rlebbar
Newbie
Newbie
Posts: 18
Joined: Fri Mar 02, 2012 12:00 am

Re: TeeChart Speed on IOS

Post by rlebbar » Mon Mar 19, 2012 5:49 pm

Hi Yeray

The OnChartClick seems to be more stable than the SpeedButtonClick.
But as you may notice when you click on the chart the very first time it gets redrawn once more (only the first click).

With the SpeedButtonClick it is worst since the Chart is redrawn more than 5 Times at each click.

Could you please help me get a very basic workaround since in my case there is no reason to let the chart be redrawn once the OnAfterDraw event is hit. So the question is how to freeze the chart ? (Not allowing it to be redrawn).

Thanks in advance.
r.lebbar

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

Re: TeeChart Speed on IOS

Post by Yeray » Tue Mar 20, 2012 10:28 am

Hi r.lebbar,

TButton is also stable. It actually seems to be a non related TeeChart problem: if you remove the chart and use the Form OnPaint event instead of the chart OnBeforeDrawChart/OnAfterDraw events, it behaves exactly the same:

Code: Select all

procedure TForm1.FormPaint(Sender: TObject; Canvas: TCanvas;
  const ARect: TRectF);
begin
  Inc(NbreOfTimesTheChartIsDrawn);
end;
I've opened a ticket in Embarcadero's Quality Central. You can vote for it.
http://qc.embarcadero.com/wc/qcmain.aspx?d=104281

In the meanwhile I'd suggest you to use TButton instead of TSpeedButton.
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

rlebbar
Newbie
Newbie
Posts: 18
Joined: Fri Mar 02, 2012 12:00 am

Re: TeeChart Speed on IOS

Post by rlebbar » Fri Mar 23, 2012 9:42 am

Hi Yeray

Thanks for your help, I have finally a decent loading time !

By using a Private variable fIsAlreadyDrawn in the Form, one can do :
procedure TFChart.TestChartAfterDraw(Sender: TObject);
begin
fIsAlreadyDrawn := True;
end;
procedure TFChart.TestChartBeforeDrawChart(Sender: TObject);
begin
if fIsAlreadyDrawn Then Abort
end;
This works on Windows but not on the real IOS device.
Then I added a property variable IsAlreadyDrawn to the Chart in the FMI code.
It drops by arround 50% the necessary time to load the chart .
I know that this is just a workaround until a real solution is found.

Many Thanks.
r.lebbar

Post Reply