Page 1 of 1
Cursor-Tool Performance Problem [Urgent]
Posted: Fri Oct 28, 2011 4:37 pm
by 14045168
we are using 2 teecharts and sync the cursor tools of both charts in the CursorTool_Change Event.
It works ok when we hide the axes of the charts, but that is no option for us. When we show the axes of the charts, the performance is very bad (tested on an an up-to-date Intel i7 cpu).
The reason for the bad performance is, that the teechart permanently repaints the axes and axes-labels. How can we cancel the repaint, while moving with the cursor-tool ?
Or are there any other solutions ?
Sample project attached.....
Re: Cursor-Tool Performance Problem [Urgent]
Posted: Mon Oct 31, 2011 12:48 pm
by 10050769
Hello JanG,
Ok, I have modified your code, changing the way to add values, I have used two arrays and seems these increase your performance of your project. Please, check if the modificacions I have added in your project help you to increase performance of your application.
I hope will helps.
Thanks,
Re: Cursor-Tool Performance Problem [Urgent]
Posted: Mon Oct 31, 2011 2:11 pm
by 14045168
Hello Sandra,
thanks for your reply. I can see no difference with your code at all. The cursor tool of one chart still lags behind while you move the mouse on the other chart. Besides it is no option to set both charts to the same datasource as the data is different for each chart. When I first tested your code with a remote desktop connnection the cursors of both charts "nearly" looked synchronized, but not when I was in front of the machine. If you develop in a virtual machine, you might get the same effect. In this case, try running the compiled application on a pc directly. With my example you should see that the cursor for one chart lags behind and if you press the Axis Labels OFF button both cursors are synchronized.
Thanks for your efforts.
Kind regards,
Jan
Re: Cursor-Tool Performance Problem [Urgent]
Posted: Wed Nov 02, 2011 1:34 pm
by 10050769
Hello JanG,
You are right and I have added it, after doing many test, in whis-list with number (TF02015808). We will try to fix it for next maintenance releases of TeeChart.Net
Thanks,
Re: Cursor-Tool Performance Problem [Urgent]
Posted: Thu Dec 29, 2011 12:52 pm
by 10050769
Hello JanG,
We have made a simple code as a workaround that you can help to improve the performance of your CursorTool:
Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Steema.TeeChart.Drawing;
using Steema.TeeChart.Styles;
using Steema.TeeChart;
namespace WindowsFormsApplication29
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
InitializeChart();
}
private const int pointCount = 100;
//Optimisize code.
private double[] XValues = new double[pointCount];
private double[] YValues = new double[pointCount];
private double[] XValues1 = new double[pointCount];
private double[] YValues1 = new double[pointCount];
private Steema.TeeChart.Tools.CursorTool CursorTool1;
private Steema.TeeChart.Tools.CursorTool CursorTool2;
Steema.TeeChart.Styles.FastLine line1, line2;
private void InitializeChart()
{
line1 = new FastLine(tChart1.Chart);
line2 = new FastLine(tChart2.Chart);
int i = 0;
Random rnd = new Random();
for (i = 0; i < pointCount; i++)
{
XValues[i] = i;
YValues[i] = rnd.Next(1000);
}
line1.Add(XValues, YValues);
for (i = 0; i < pointCount; i++)
{
XValues1[i] = i;
YValues1[i] = rnd.Next(1000);
}
line2.Add(XValues1, YValues1);
//CursorTool
CursorTool1 = new Steema.TeeChart.Tools.CursorTool(tChart1.Chart);
CursorTool2 = new Steema.TeeChart.Tools.CursorTool(tChart2.Chart);
CursorTool1.FollowMouse = true;
CursorTool2.FollowMouse = true;
CursorTool2.FastCursor = true;
//Code doesn't work when use next!
CursorTool1.Change += new Steema.TeeChart.Tools.CursorChangeEventHandler(CursorTool1_Change);
CursorTool2.Change += new Steema.TeeChart.Tools.CursorChangeEventHandler(CursorTool2_Change);
}
private void CursorTool1_Change(object sender, Steema.TeeChart.Tools.CursorChangeEventArgs e)
{
CursorSynchronize(CursorTool1, CursorTool2);
}
private void CursorTool2_Change(object sender, Steema.TeeChart.Tools.CursorChangeEventArgs e)
{
CursorSynchronize(CursorTool2, CursorTool1);
}
private void Button1_Click(System.Object sender, System.EventArgs e)
{
tChart1.Axes.Bottom.Labels.Visible = true;
tChart2.Axes.Bottom.Labels.Visible = true;
tChart1.Axes.Left.Labels.Visible = true;
tChart2.Axes.Left.Labels.Visible = true;
}
private void Button2_Click(System.Object sender, System.EventArgs e)
{
//When the labels aren't visible Cursor Synchronize correctly.
tChart1.Axes.Bottom.Labels.Visible = false;
tChart2.Axes.Bottom.Labels.Visible = false;
tChart1.Axes.Left.Labels.Visible = false;
tChart2.Axes.Left.Labels.Visible = false;
}
private void CursorSynchronize(Steema.TeeChart.Tools.CursorTool SRC, Steema.TeeChart.Tools.CursorTool DEST)
{
DEST.Chart.AutoRepaint = false;
DEST.XValue = SRC.XValue;
DEST.Chart.AutoRepaint = true;
DEST.YValue = SRC.YValue;
}
}
}
I hope will helps.
Thanks,