I narrowed down in my code what is using alot of time. And it's down to the Range object for the Y axis. I use a time format for the yaxis. When data comes in (1/sec), I get the time of that data and set the min and max of the yaxis. To do this you have to new a Range object and set the yaxis Range object to the newed object.
This takes about 200ms to set the yaxis range alone, for a graph around 800 pixels hight by 3200 pixels wide! Not counting manipulating the background bitmap. The NI graph activeX control I used last year definitely did not take this long.
Is this expected behavior? Am I doing something wrong in setting the yaxis?
-VS 2003
-C#
-XP
See attached jpg for part of what my graph looks like.
Code snippet:
public void SetYAxis(DateTime currentTime)
{
Debug.WriteLine("BitmapDisplayCtrl SetYAxis");
if( _Dispose )
return;
//Bitmap bm = (Bitmap)_NIGraph.PlotAreaImage;
Range rng;
DateTime minTime, maxTime;
if( _DirectionOfDataFlow == DataFlowDirection.TopToBottom )
{
minTime = currentTime;
maxTime = currentTime.AddSeconds(_NIGraph.PlotAreaImage.Height);
yPrimaryAxis.Inverted = false;
}
else
{
minTime = currentTime;
maxTime = currentTime.AddSeconds(_NIGraph.PlotAreaImage.Height);
yPrimaryAxis.Inverted = true;
}
try
{
rng = new Range(minTime, maxTime);
yPrimaryAxis.Range = rng;
}
catch( InvalidOperationException ie )
{
Console.WriteLine(ie.Message);
}
}
Message Edited by scottyoo on 04-12-2005 05:03 PM