Very slow CursorTool
Posted: 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));
}
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));
}