C# Oxyplot不';t显示时间轴的值
我想以毫秒为单位在时间轴上绘制数据值。 这是我的方法:C# Oxyplot不';t显示时间轴的值,c#,plot,diagram,milliseconds,oxyplot,C#,Plot,Diagram,Milliseconds,Oxyplot,我想以毫秒为单位在时间轴上绘制数据值。 这是我的方法: myModel = new PlotModel(); myModel.Axes.Add(new LinearAxis()); myModel.Axes.Add(new DateTimeAxis() { Position = AxisPosition.Bottom, StringFormat = "HH:mm:ss", IntervalLength = 60, MinorIntervalType = Date
myModel = new PlotModel();
myModel.Axes.Add(new LinearAxis());
myModel.Axes.Add(new DateTimeAxis()
{
Position = AxisPosition.Bottom,
StringFormat = "HH:mm:ss",
IntervalLength = 60,
MinorIntervalType = DateTimeIntervalType.Milliseconds,
IntervalType = DateTimeIntervalType.Milliseconds,
MajorGridlineStyle = LineStyle.Solid,
MinorGridlineStyle = LineStyle.Solid,
});
var cs = new LineSeries();
for (int i = 1; i < 10; i++) //generate test values
{
var dp = new DataPoint()
{
X = DateTimeAxis.ToDouble(DateTime.ParseExact("14:02:02.0" + Convert.ToString(i + 9), "HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture)),
Y = i * i
};
cs.Points.Add(dp);
}
myModel.Series.Add(cs);
时间被正确解析,但Oxyplot不知何故无法处理它。第一个猜测:当您更改日期-时间解析时,由于for循环和添加时间的方式,您的值突然在毫秒范围内。e、 g
"14:02: + Convert.ToString(i+9)" gives you 14:02:10 through 14:02:18
"14:02:02.0 + Convert.ToString(i+9)" gives you 14:02:02.10 through 14:02:02.18
给定DateTimeAxis的格式字符串
StringFormat = "HH:mm:ss"
它无法显示毫秒分辨率,因此您什么也看不到。将字符串格式更改(或不指定)为:
或者指定一个标签格式化程序,以毫秒分辨率选择性地显示,类似于以下问题:第一个猜测:当您更改日期-时间解析时,由于for循环和添加时间的方式,您的值突然在毫秒范围内。e、 g
"14:02: + Convert.ToString(i+9)" gives you 14:02:10 through 14:02:18
"14:02:02.0 + Convert.ToString(i+9)" gives you 14:02:02.10 through 14:02:02.18
给定DateTimeAxis的格式字符串
StringFormat = "HH:mm:ss"
它无法显示毫秒分辨率,因此您什么也看不到。将字符串格式更改(或不指定)为:
或者指定一个标签格式化程序以毫秒分辨率选择性显示,类似于以下问题:关于,不要这样做。相反,请发表你自己的答案。关于这一点,不要这样做。相反,请发表你自己的答案。