Scrolling & ProcessorLoad

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Newbie
Newbie
Newbie
Posts: 13
Joined: Fri May 14, 2004 4:00 am
Location: Leiden

Scrolling & ProcessorLoad

Post by Newbie » Tue Apr 01, 2008 1:20 pm

Hi,

Using TeeChart 7.04 I've created a 1000 points sweepchart which cycles around when at the end of data. In 'RealTime', a point in a serie is replaced.
This works very well, with a total processorload of 0 - 2 % for the whole data acquisition application.

The customer is able to scroll (pan) only vertically in the graph during running. Both the Left (Y) and Bottom (X) axes are fixed scaled, ClipPoints = False and all other tricks for fast graphing are implemented.

However, when the customers scrolls too extensively, firmly holding down the right mouse button and fastmoving of the mouse, the processorloads increases > 90%. This will cause loss of data...
This might be obvious, as you should not hold down the right mousebutton in this way, though I'm not in front of the customer every day.

Is'nt there a flag somewehere wich I could check in the OnAllowScroll event to disable scrolling when a scroll is active? i.e. slowing down the excessive repaints?

Thanks in advance for your support!

Kind regards,

Davy

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

Post by Narcís » Tue Apr 01, 2008 1:29 pm

Hi Davy,

First of all, please notice that latest TeeChart Pro v7 VCL release available at the client download area is v7.12. You may be interested in using that version and check if it solves the problem at your end.

Alternativelly you can use the OnMouseMove event (or any other mouse event) like this:

Code: Select all

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  if (Shift = Chart1.ScrollMouseButton) then
    Chart1.AllowPanning := false
  else
    Chart1.AllowPanning := true;
end;
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

Newbie
Newbie
Newbie
Posts: 13
Joined: Fri May 14, 2004 4:00 am
Location: Leiden

Post by Newbie » Tue Apr 01, 2008 2:01 pm

Hi Narcis,

Thanks for your reply.
I assume that this code is the same as you propose:

Code: Select all

if (ssRight in Shift) then
    Chart1.AllowPanning := pmNone
else
   Chart1.AllowPanning := pmVertical;

This code just disable scrolling at all, which is not our goal.

Customer should be able to Pan, but without excessive repaints when holding the R mouse button firmly down while fast moving the mouse.


Kind regards,

Davy.

TeeChart 7.04 & Delphi 7

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

Post by Narcís » Tue Apr 01, 2008 2:05 pm

Hi Davy,

Yes, sorry, my code doesn't even compile :(.

Latest binary release for Delphi 7 is v7.07 while latest sourcecode version is v7.12. Could you please try if those versions enhance the performance at your end?
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

Newbie
Newbie
Newbie
Posts: 13
Joined: Fri May 14, 2004 4:00 am
Location: Leiden

Post by Newbie » Tue Apr 01, 2008 2:39 pm

Hi Narcis,

Have installed binary release 7.07 and there is no enhancement of the performance.

Kind regards,

Davy

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

Post by Yeray » Wed Apr 02, 2008 9:02 am

Hi Davy,

Here i can suggest you two possibilities depending on the repaint frequency you wish.

You could disable autorepaint when right mouse button is pressed and only repaint and draw new values when user holds up the right mouse:

Code: Select all

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button = Chart1.ScrollMouseButton then
    Chart1.AutoRepaint := false;
end;

procedure TForm1.Chart1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button = Chart1.ScrollMouseButton then
  begin
    Chart1.AutoRepaint := true;
    Chart1.Repaint;
  end;
end;
And the other possibility is adding a timer and give him a repaint interval:

Code: Select all

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button = Chart1.ScrollMouseButton then
  begin
    Chart1.AutoRepaint := false;
    Timer1.Enabled := true;
  end;
end;

procedure TForm1.Chart1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Button = Chart1.ScrollMouseButton then
    Timer1.Enabled := false;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Chart1.AutoRepaint := true;
  Chart1.Repaint;
  Chart1.AutoRepaint := false;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Timer1.Interval := 1000;
  Timer1.Enabled := false;
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

Newbie
Newbie
Newbie
Posts: 13
Joined: Fri May 14, 2004 4:00 am
Location: Leiden

Post by Newbie » Wed Apr 02, 2008 10:20 am

Hi Yeray,

Thanks for your idea's. They have stimulated my creativity!

As there is a running timer in the application for observing and processing data acquisition data, I can use this timer as well for slowing down repaints when customer is teasing the application.

Kind regards,

Davy

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

Post by Yeray » Fri Apr 04, 2008 9:33 am

Hi Davy,

I'm really glad to see that!
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

Post Reply