Problems with late drawing response
Posted: Thu Mar 22, 2007 4:27 pm
Hi,
I am experiencing a lag in performance when performing action similar to the Curve Fitting Demo Application in the TeeChart live demo.
To summarize:
I have n Series on a chart, and i have also a ShapeSerie for each of them in a form of a little circle that is moving according to the mouse motion on the curves. The calculations are the ones used in the demo (where it shows good results) with one difference that the circle is drawn on the original series and not on a fitted curve.
Can it be that the lag is happening because of the fact that the MouseMotionListener is taking up way too much CPU time so the drawing is lagged?
The code that I'm using for the calculations is the following:
(x is the current x position of the mouse)
double tmpX = mainChart.getAxes().getBottom().calcPosPoint(x);
int i = (int)Math.round(tmpX);
double tmpY;
try
{
tmpY = mainSeries.getYValues().getValue(i);
}
catch(ArrayIndexOutOfBoundsException e)
{
return;
}
int yValue = mainChart.getAxes().getLeft().calcPosValue(tmpY);
int xValue = mainChart.getAxes().getBottom().calcPosValue(i);
Thank you in advance to all the responses.
UniCoders
I am experiencing a lag in performance when performing action similar to the Curve Fitting Demo Application in the TeeChart live demo.
To summarize:
I have n Series on a chart, and i have also a ShapeSerie for each of them in a form of a little circle that is moving according to the mouse motion on the curves. The calculations are the ones used in the demo (where it shows good results) with one difference that the circle is drawn on the original series and not on a fitted curve.
Can it be that the lag is happening because of the fact that the MouseMotionListener is taking up way too much CPU time so the drawing is lagged?
The code that I'm using for the calculations is the following:
(x is the current x position of the mouse)
double tmpX = mainChart.getAxes().getBottom().calcPosPoint(x);
int i = (int)Math.round(tmpX);
double tmpY;
try
{
tmpY = mainSeries.getYValues().getValue(i);
}
catch(ArrayIndexOutOfBoundsException e)
{
return;
}
int yValue = mainChart.getAxes().getLeft().calcPosValue(tmpY);
int xValue = mainChart.getAxes().getBottom().calcPosValue(i);
Thank you in advance to all the responses.
UniCoders