Very slow CursorTool
Very slow CursorTool
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));
}
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));
}
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Very slow CursorTool
Hi JohnS,
Have you tried setting FastCursor to true? For example:
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 |
Instructions - How to post in this forum |
Re: Very slow CursorTool
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).
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).
Re: Very slow CursorTool
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?
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?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Very slow CursorTool
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 |
Instructions - How to post in this forum |
Re: Very slow CursorTool
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.
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 (65.47 KiB) Viewed 12523 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Very slow CursorTool
Yes, you are right. I have added the defect to the bug list (TF02016707) so that CursorTool.FastCursor functionality is revised and fixed.JohnS wrote:Look it this example of reproducing a bug in CursorTool when FastCursor = true:
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 |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Very slow CursorTool
Hi JohnS,
BTW, Have you tried TeeChart.Direct2D.dll for that kind of application?
Thanks in advance.
I can not reproduce this with your example. What should I do to get zoom crashing with DrawAllPoints set to false?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).
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 |
Instructions - How to post in this forum |
Re: Very slow CursorTool
I sent you my program with a description how to reproduce the issue.
Could you see it?
Could you see it?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Very slow CursorTool
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.
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 |
Instructions - How to post in this forum |