Question

I'm able to plot the serial data with the current time. Suppose I give myPane.XAxis.Scale.Min = 0; and some max value, how do I get them to reflect on " list.add(... , value); "

"..." is what i'm not able figure what should be passed. I was using the below code for HH:mm:ss. However I need the X axis to be such that it starts from 00:00 till say 5minutes.

myPane.XAxis.Scale.MaxAuto = true;
myPane.XAxis.Scale.MinAuto = true;
myPane.XAxis.Type = AxisType.Date;
myPane.XAxis.Scale.Format = "HH:mm:ss";
myPane.Legend.Position = ZedGraph.LegendPos.TopCenter;

DateTime now = new DateTime();
now = DateTime.Now; double timestamp = new XDate(now);
list.Add(timestamp, f);

I would appreciate your suggestions

Was it helpful?

Solution

I do not know it helps you but this is my code for real time data plotting.

/*Initial pane settings*/
pane.XAxis.Type = AxisType.Date;
pane.XAxis.Scale.Format = "dd/MM/yy\nH:mm:ss";
pane.XAxis.Scale.Min = (XDate)(DateTime.Now);
//Shows 25 seconds interval.
pane.XAxis.Scale.Max = (XDate)(DateTime.Now.AddSeconds(25));
pane.XAxis.Scale.MinorUnit = DateUnit.Second;
pane.XAxis.Scale.MajorUnit = DateUnit.Minute;
pane.XAxis.MajorTic.IsBetweenLabels = true;
pane.XAxis.MinorTic.Size = 5;

/*Real time plotting*/
XDate time = new XDate(DateTime.Now.ToOADate());
LineItem curve= curve= myPane.CurveList[0] as LineItem;
IPointListEdit list = list = curve.Points as IPointListEdit;
list.Add(time,data);
//Scale pane if current time is greater than the initial xScale.Max
Scale xScale = zgcMasterPane.MasterPane.PaneList[0].XAxis.Scale;
if (time.XLDate > xScale.Max)
{
  xScale.Max = (XDate)(DateTime.Now.AddSeconds(5));
  xScale.Min = (XDate)(DateTime.Now.AddSeconds(-20));
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top