Drawing speed enhancement

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
beetle
Newbie
Newbie
Posts: 59
Joined: Fri Dec 12, 2003 5:00 am

Drawing speed enhancement

Post by beetle » Wed Jun 24, 2009 6:56 am

Hi!

I would like to know about all options I have to enhance drawing speed. I already use all recommendations in your "Real-time charting in TeeChart VCL" article since several years ago, but yet I'm trying to improve speed with other complementary ways. Besides, some of my charts have to use other kind of TChartSeries (different to TFastLineSeries). A couple ideas came up:

1) Using a very powerful graphic card, but TeeChart should use OpenGL or DirectX. I tried to use the TTeeOpenGL component and associate it to any of my TChart's, activate it but all I got is not to see anything :) How is TTeeOpenGL supposed to work? is a solution to my needs?
2) Improving my graphic classes with much complicated code.

Any tips following the first idea? I don't care If I had to spend a lot of money in a superb graphic card :twisted:

Thanks!!

beetle
Newbie
Newbie
Posts: 59
Joined: Fri Dec 12, 2003 5:00 am

Re: Drawing speed enhancement

Post by beetle » Wed Jun 24, 2009 7:04 am

I forgot to mention that almost all charts I need to improve are 2D.

Thanks!

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

Re: Drawing speed enhancement

Post by Narcís » Thu Jun 25, 2009 8:48 am

Hi beetle,

You just need to add a TTeeOpenGL component to your form, associate it to a chart and activate it, for example:

Code: Select all

uses TeeOpenGL;

procedure TForm4.FormCreate(Sender: TObject);
var TeeOpenGL1: TTeeOpenGL;
begin
  TeeOpenGL1:=TTeeOpenGL.Create(self);
  TeeOpenGL1.TeePanel:=Chart1;
  TeeOpenGL1.Active:=true;

  Chart1.Aspect.Zoom:=50;
end;
Using code above works fine for me here using TeeChart Pro v8.05 VCL. If problem persits please attach a simple example project we can run "as-is" to reproduce the problem here.

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

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

Re: Drawing speed enhancement

Post by Yeray » Thu Jun 25, 2009 8:55 am

Hi beetle,

To increase drawing speed, have you tried using DownSampling Function?
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

beetle
Newbie
Newbie
Posts: 59
Joined: Fri Dec 12, 2003 5:00 am

Re: Drawing speed enhancement

Post by beetle » Thu Jun 25, 2009 6:06 pm

Hi,

The DownSampling is not suitable for my charts because I use several own chart tools to identify and match points between several different charts (altough representing the same data).
The TTeeOpenGL doesn't seem to work in 2D charts, only 3D (and It works really weird).

Thanks.

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

Re: Drawing speed enhancement

Post by Narcís » Fri Jun 26, 2009 7:15 am

Hi beetle,

It works fine for me here using TeeChart Pro v8.05 VCL. Can you please confirm the exact TeeChart vresion you are using? Can you also attach a simple example project we can run "as-is" to reproduce the problem here?

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

beetle
Newbie
Newbie
Posts: 59
Joined: Fri Dec 12, 2003 5:00 am

Re: Drawing speed enhancement

Post by beetle » Fri Jun 26, 2009 8:01 am

Hi Narcis,

It's been a while that I'm using TeeChart Pro v7.12 Win32 and CodeGear™ C++Builder® 2007.
You are referring to TeeOpenGL, aren't you? If so, check the attached zip file. It includes the Builder project, the executable file renamed to have .axe extension (TeeOpenGLTest.axe in the Debug folder) and 2 screenshots showing how I see it working, in 2D and 3D. 2D mode doesn't represent the series and 3D mode doesn't show axes and it has a cheesy appearance :lol: , among other things.

Thanks!
Attachments
TeeOpenGLTest.rar
(416.96 KiB) Downloaded 788 times

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

Re: Drawing speed enhancement

Post by Yeray » Fri Jun 26, 2009 10:48 am

Hi beetle,

It's strange, running your exe in two different machines I get always a visible line in 2D and a line that looks a little bit better in 3D.
I've modified you project to add a zoom of 40% to see the axes with opengl. And I've added an about box that would show you if the application is getting TeeChart v7.12 or not.
Attachments
TeeOpenGLTest.zip
(482.4 KiB) Downloaded 765 times
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

beetle
Newbie
Newbie
Posts: 59
Joined: Fri Dec 12, 2003 5:00 am

Re: Drawing speed enhancement

Post by beetle » Fri Jun 26, 2009 11:31 am

Hi Yeray,

I tried your exe file and I compiled your changes myself, and the result is in the screenshots attached. As you may see, 2D series doesn't appear and the looking is really hideous in both views :lol:
I also tried in another computer using the same runtime packages of TeeChart (Tee711.bpl, etc.)
Could you please send me screenshots of the same exe file running in your computer? and the exe file compiled with your latest version of TeeChart?

Thanks!
Attachments
TeeOpenGLTestScreenshots.rar
(58.96 KiB) Downloaded 727 times

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

Re: Drawing speed enhancement

Post by Yeray » Fri Jun 26, 2009 1:26 pm

Hi beetle,

Here there are the screenshots that the program shows for me here with latest v7 sources. As you are a source code customer, I've sent the url to download the actual v7 sources to your forums registered account. Could you please try if them solve the issue?
Attachments
screenshots.zip
(69.78 KiB) Downloaded 740 times
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

beetle
Newbie
Newbie
Posts: 59
Joined: Fri Dec 12, 2003 5:00 am

Re: Drawing speed enhancement

Post by beetle » Fri Jun 26, 2009 7:07 pm

Hi,

I saw your screenshots and the appearance are similiar to mine (texts are blury, for example), although 2D view does paint the series. So, isn't it possible to get the same looking for charts than without using TeeOpenGL?

Thanks.

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

Re: Drawing speed enhancement

Post by Yeray » Mon Jun 29, 2009 8:29 am

Hi beetle,

I'll add those differences to the wish list to be revised for further releases. As you said, texts with small fonts look a little bit blurry (here I can only think in making them bigger for the moment). I also can see that the legend color doesn't respond as expected with OpenGL.

Could you please tell us what other differences are you viewing? Thanks in advance.
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

beetle
Newbie
Newbie
Posts: 59
Joined: Fri Dec 12, 2003 5:00 am

Re: Drawing speed enhancement

Post by beetle » Thu Jul 02, 2009 7:48 am

Hi,

I uploaded two images for you to see how I currently see 4 of my graphs and how I see them using TeeOpenGL. As you may see, 2D series are not shown using TeeOpenGL, so I can't tell differences.
Anyways, I'm trying to enhance my source code and I have one question: How could I know the drawn points number of a series when the event OnGetPointerStyle is triggered? I mean, the forthcoming visible points number. Since this event is triggered before OnBeforeDrawAxes (and before OnBeforeChartDraw), if I just zoomed, I can't figure out how to know that.

Thanks!
Attachments
TeeChartVDMOpenGLView.jpg
TeeChartVDMOpenGLView.jpg (60.69 KiB) Viewed 18931 times
TeeChartVDMCurrentView.jpg
TeeChartVDMCurrentView.jpg (271.96 KiB) Viewed 18960 times

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

Re: Drawing speed enhancement

Post by Yeray » Thu Jul 02, 2009 8:50 am

Hi beetle,

Maybe you should consider using AntiAlias Tool instead of OpenGL since it wasn't thought to be used with 2D.

On the other hand, I still think that the first problem is that activating OpenGL, the chart is moved and zoomed. So, if you still want to use OpenGL, you should try to find the correct zoom, HorizontalOffset, etc... values for your charts like in the following example (I recommend you to use a TeeCommander to find the values easily):

Code: Select all

uses TeeOpenGL;

var Series1: TPointSeries;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1 := TPointSeries.Create(self);
  Series1.ParentChart := Chart1;
  Series1.FillSampleValues(200);
  Chart1.View3D := false;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  with TTeeOpenGL.Create(self) do
  begin
    TeePanel := Chart1;
    Active := true;
  end;

  Chart1.View3D := true;
  Chart1.Aspect.Zoom := 50;
  Chart1.Aspect.Elevation := 0;
  Chart1.Aspect.Rotation := 0;
  Chart1.Aspect.HorizOffset := -300;
  Chart1.Aspect.VertOffset := -300;
end;
And regarding the "number of shown points" issue, you should calculate it manually doing something like following:

Code: Select all

procedure TForm1.Chart1Zoom(Sender: TObject);
var i, numVisiblePoints: Integer;
begin
  Chart1.Repaint;
  numVisiblePoints := 0;
  for i:=0 to Series1.Count-1 do
  begin
    if PtInRect(Chart1.ChartRect, Point(Series1.CalcXPos(i),Series1.CalcYPos(i))) then
      numVisiblePoints := numVisiblePoints+1;
  end;
  Chart1.Title.Text.Text := inttostr(numVisiblePoints);
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

Post Reply