I
Israel
I'm trying to use NPlot to create my own strip chart recorder but I'm
not having luck getting it to clip the range of the x-axis like I
think it should. If use double's for the x axis then it displays the
values exactly as I want them - i.e. to start up with it's all blank
and then slowly data starts appearing from the right and side and
moving left. If I use DateTime for the type of the x data then it
never dispalys anything unless I DON'T try to set the range on the x-
axis (i.e. WorldMin and WorldMax). Then it auto-scales it which is
not what I want because I want the range to be constant.
This is basically the code I'm trying to run:
private void MethodCalledEverySecond()
{
plotSurface.Clear();
DateTime[] x = new DateTime[m_DataPoints.Count];
double[] y = new double[m_DataPoints.Count];
// Populate x[] + y[] with data from m_DataPoints
DateTime EndDT = DateTime.Now;
DateTime StartDT = EndDT - new TimeSpan(0,0,0,30,0); // 30 seconds
ago
LinePlot linePlot = new LinePlot();
linePlot.OrdinateData = y;
linePlot.AbscissaData = x;
plotSurface.Add( linePlot );
DateTimeAxis dateTimeAxis = new DateTimeAxis(plotSurface.XAxis1);
// This will cause not data to be displayed
dateTimeAxis.WorldMin = StartDT.ToOADate();
dateTimeAxis.WorldMax = EndDT.ToOADate();
plotSurface.XAxis1 = dateTimeAxis;
plotSurface.Refresh();
}
not having luck getting it to clip the range of the x-axis like I
think it should. If use double's for the x axis then it displays the
values exactly as I want them - i.e. to start up with it's all blank
and then slowly data starts appearing from the right and side and
moving left. If I use DateTime for the type of the x data then it
never dispalys anything unless I DON'T try to set the range on the x-
axis (i.e. WorldMin and WorldMax). Then it auto-scales it which is
not what I want because I want the range to be constant.
This is basically the code I'm trying to run:
private void MethodCalledEverySecond()
{
plotSurface.Clear();
DateTime[] x = new DateTime[m_DataPoints.Count];
double[] y = new double[m_DataPoints.Count];
// Populate x[] + y[] with data from m_DataPoints
DateTime EndDT = DateTime.Now;
DateTime StartDT = EndDT - new TimeSpan(0,0,0,30,0); // 30 seconds
ago
LinePlot linePlot = new LinePlot();
linePlot.OrdinateData = y;
linePlot.AbscissaData = x;
plotSurface.Add( linePlot );
DateTimeAxis dateTimeAxis = new DateTimeAxis(plotSurface.XAxis1);
// This will cause not data to be displayed
dateTimeAxis.WorldMin = StartDT.ToOADate();
dateTimeAxis.WorldMax = EndDT.ToOADate();
plotSurface.XAxis1 = dateTimeAxis;
plotSurface.Refresh();
}