1

I have a data of time of consecutive heart beats (in milliseconds) and I'm trying to make a dynamic chart of them. So on XAxis I have XDate variable increased by .AddMilliseconds(heart_beat_time) and on YAxis heart_beat_time.

When I use AxisType.Date it's pretty good. I can change Min, Max and other related values, but when I change to AxisType.DateAsOrdinal I can not see points nor labels. During some debugging it has showed up that Zedgraph does paint the points and labels, but there are very large gaps between consecutive ones.

How can I control DateAsOrdinal Min, Max, MajorStep and so on? There is an answer Format DateAsOrdinal xAxis labels in ZedGraph but it doesn't work for me.

There are two reasons I want to make it work:

  1. Ordinal seems to be faster (as I got nearly 100k points)

  2. With AxisType.Date when I scroll chart automatically it's not showing labels under ticks

My code:

myPane.XAxis.Type = AxisType.DateAsOrdinal;
myPane.XAxis.Scale.MajorStepAuto = false;
myPane.XAxis.Scale.MinorStepAuto = false;
myPane.XAxis.Scale.MajorUnit = DateUnit.Minute;
myPane.XAxis.Scale.MinorUnit = DateUnit.Minute;
myPane.XAxis.Scale.Format = "HH:mm:ss";
myPane.XAxis.Scale.Min = Min;
myPane.XAxis.Scale.Max = Max;
myPane.XAxis.Scale.MinorStep = minor;
myPane.XAxis.Scale.MajorStep = major;
myPane.XAxis.Scale.BaseTic = new XDate(1999, 1, 1, 0, 0, 0, 0);
myPane.YAxis.Scale.Min = min_rr;
myPane.YAxis.Scale.Max = max_rr;

where

int min_rr = 100;
int max_rr = 2500;
XDate Min = new XDate(1999, 1, 1, 0, 0, 0, 0);
XDate Max = new XDate(1999, 1, 1, 1, 0, 0, 0);
int minor = 5;
int major = 10;
Community
  • 1
  • 1
levy
  • 41
  • 1
  • 5

1 Answers1

0

I have the same problem (no graph or labels on XAxis) when using AxisType.DateAsOrdinal.

I solved by omitting the code lines myPane.XAxis.Scale.Min=??? and Max=???. This gives me a nice graph without gaps.

However now I have problems with the MousePositionValues function in my MouseMoveEvent.

Msonic
  • 1,456
  • 15
  • 25
jwa
  • 1
  • 2
  • **Sorry for 2 in line - time limit :/** `DateAsOrdinal` keeps number of points on screen not period of time according to `Min` and `Max` So you got to set `Min=0` and `Max = numberOfPoints`. The same is with `MajorStep` and `MinorStep` - it's number of points between tics. I think it may cause a problem if you don't know what data you are putting into chart - it can become unreadable because of scale. – levy Apr 14 '12 at 15:00