Very slow CursorTool

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
JohnS
Newbie
Newbie
Posts: 31
Joined: Mon Aug 26, 2013 12:00 am

Very slow CursorTool

Post by JohnS » Thu Sep 05, 2013 10:32 am

Hi,

We experience the Cursor Tool to be very slow drawing.
To track down the problem we ended up isolating it with the following code.
Note that only one series is added.
When more points are added to this series the CursorTool is responding slower and slower.
When setting DrawAllPoints to false the CursorTool gets faster (still not impressive),
but the DrawAllPoints functions is throwing exception when zooming (had this problem approx. five years ago too, now we have given up using it).

What can we do to make the CursorTool reacting faster (too much overhead internally??)?

tChart1.Aspect.ClipPoints = true; //Cut values that are outside ChartRect
tChart1.Aspect.View3D = false;
tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;
tChart1.AutoRepaint = true;
tChart1.Axes.Bottom.Automatic = true;
tChart1.Axes.Bottom.Labels.DateTimeFormat = "HH:mm:ss";
tChart1.Axes.Bottom.Labels.Font.Name = "Arial";
tChart1.Axes.Bottom.Labels.Font.Size = 10;
tChart1.Axes.Bottom.Labels.RoundFirstLabel = false;
tChart1.Axes.Bottom.Labels.Separation = 0; //Disable automatic control of the increment factor
tChart1.Axes.Bottom.Labels.Style = AxisLabelStyle.Value; //Labels display axis scales
tChart1.Axes.Bottom.MinimumOffset = 1; //Workaround for first labels disappearing
tChart1.Axes.Bottom.Title.Font.Name = "Arial";
tChart1.Axes.Bottom.Title.Font.Size = 12;
tChart1.Axes.Depth.Visible = false;
tChart1.Axes.DepthTop.Visible = false;
tChart1.Axes.Left.Visible = true;
tChart1.Axes.Left.Automatic = true;
tChart1.Axes.Right.Visible = false;
tChart1.Axes.Top.Visible = false;
tChart1.BackColor = Color.White;
tChart1.Legend.Visible = false;
tChart1.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None;
tChart1.Panel.Gradient.Visible = false;
tChart1.Panel.MarginBottom = 0;
tChart1.Panel.MarginLeft = 0;
tChart1.Panel.MarginRight = 0;
tChart1.Panel.MarginTop = 0;
tChart1.Panel.MarginUnits = PanelMarginUnits.Pixels;
tChart1.Panning.MouseButton = MouseButtons.Left;
tChart1.Text = "";
tChart1.Walls.Back.Color = Color.White;
tChart1.Walls.Back.Gradient.Visible = false;
tChart1.Zoom.Allow = true;
tChart1.Zoom.Direction = ZoomDirections.Both;
tChart1.Zoom.MouseButton = MouseButtons.Left;
tChart1.Zoom.Pen.Color = Color.Black;
tChart1.Panning.Allow = ScrollModes.None;

//Cursor tool
CursorTool cursorTool = new CursorTool();
tChart1.Tools.Add(cursorTool);
cursorTool.FollowMouse = true;
cursorTool.ScopeStyle = ScopeCursorStyle.Empty;
cursorTool.Pen.Visible = true;

for (int i = 0; i < 1; i++)
{
tChart1.Series.Add(new Steema.TeeChart.Styles.FastLine(tChart1.Chart));

tChart1.Series.Visible = true;

tChart1.Series.XValues.DateTime = true;
tChart1.Series.DateTimeFormat = "HH:mm:ss";
tChart1.Series.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;
tChart1.Series.Marks.Visible = false;
(tChart1.Series as Steema.TeeChart.Styles.FastLine).TreatNaNAsNull = true;
(tChart1.Series as Steema.TeeChart.Styles.FastLine).TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint;
(tChart1.Series as Steema.TeeChart.Styles.FastLine).LinePen.Width = 2;
//(tChart1.Series as Steema.TeeChart.Styles.FastLine).DrawAllPoints = false;

Random r = new Random();
for (int j = 0; j < 80000; j++)
tChart1.Series.Add(DateTime.Now.AddSeconds(j), r.Next(500));

}

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

Re: Very slow CursorTool

Post by Narcís » Thu Sep 05, 2013 10:40 am

Hi JohnS,

Have you tried setting FastCursor to true? For example:

Code: Select all

cursorTool.FastCursor = true;
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

JohnS
Newbie
Newbie
Posts: 31
Joined: Mon Aug 26, 2013 12:00 am

Re: Very slow CursorTool

Post by JohnS » Thu Sep 05, 2013 10:48 am

Yes, I should have mentioned that.
The problem with using FastCursor is that it is flickering, and sometimes redrawing of the chart is not working correctly (e.g. lines left on chart).

JohnS
Newbie
Newbie
Posts: 31
Joined: Mon Aug 26, 2013 12:00 am

Re: Very slow CursorTool

Post by JohnS » Thu Sep 05, 2013 11:11 am

Generally speaking your .net version of TeeChart is MUCH slower than the VCL version 2010 we used with Delphi some years ago.
At that time we even worked with up to 2.000.000 point in each series, and the cursor tool still worked acceptable.
Can you recognize this picture?

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

Re: Very slow CursorTool

Post by Narcís » Thu Sep 05, 2013 11:23 am

Yes, this is mostly related to the differences between GDI Win32 (VCL's former default canvas) and GDI+ (TeeChart .NET and current VCL default canvas). We are constantly working on improving TeeChart performance. To satisfy the needs of .NET users like you we made a Direct 2D version of TeeChart .NET. You may want to check it out. I recommend you to read the white-paper for accurate information on how it performs compared to other TeeChart for .NET canvases.
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

JohnS
Newbie
Newbie
Posts: 31
Joined: Mon Aug 26, 2013 12:00 am

Re: Very slow CursorTool

Post by JohnS » Thu Sep 05, 2013 12:25 pm

Look it this example of reproducing a bug in CursorTool when FastCursor = true:

Move the cursor in our previous program example so the cursor with cross hair is drawn.
Press ALT+TAB to show a different program in Windows.
While this different program is overlapping the TeeChart program move the mouse a bit.
Press ALT+TAB to show the TeeChart program again.
Now you should see that that old cross hair is still there, and the new one together with the mouse cursor.

The enclosed screen dump shows this at our PC.
Attachments
Not redrawn.jpg
Not redrawn.jpg (65.47 KiB) Viewed 12522 times

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

Re: Very slow CursorTool

Post by Narcís » Thu Sep 05, 2013 2:57 pm

JohnS wrote:Look it this example of reproducing a bug in CursorTool when FastCursor = true:
Yes, you are right. I have added the defect to the bug list (TF02016707) so that CursorTool.FastCursor functionality is revised and fixed.

I'll also have a look at your example and see if its performance can be improved.
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

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

Re: Very slow CursorTool

Post by Narcís » Thu Sep 05, 2013 3:06 pm

Hi JohnS,
When setting DrawAllPoints to false the CursorTool gets faster (still not impressive),
but the DrawAllPoints functions is throwing exception when zooming (had this problem approx. five years ago too, now we have given up using it).
I can not reproduce this with your example. What should I do to get zoom crashing with DrawAllPoints set to false?

BTW, Have you tried TeeChart.Direct2D.dll for that kind of application?

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

JohnS
Newbie
Newbie
Posts: 31
Joined: Mon Aug 26, 2013 12:00 am

Re: Very slow CursorTool

Post by JohnS » Fri Sep 06, 2013 6:35 am

I sent you my program with a description how to reproduce the issue.
Could you see it?

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

Re: Very slow CursorTool

Post by Narcís » Fri Sep 06, 2013 8:52 am

Hi JohnS,

Yes but I can not compile it due to AxAXISMEDIACONTROLLib and AXISMEDIACONTROLLib assemblies missing. Your project is pretty big, could you please send a project which doesn't need those controls?

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

Post Reply