ZedGraph - 我正在寻找使用日期时间的示例

发布于 2024-07-13 08:33:25 字数 197 浏览 4 评论 0 原文

我正在寻找在 zedgraph 上使用日期时间字段的示例 折线图 X 轴。

编辑 - 如何设置 XAxis 最大比例

myPane.XAxis.Type = AxisType.Date;
myPane.XAxis.Scale.Min = 0;
myPane.XAxis.Scale.Max = 12;

I am looking for an example of using a datetime field on a zedgraph
linechart X-Axis.

Edit - And how do I set the XAxis max scale

myPane.XAxis.Type = AxisType.Date;
myPane.XAxis.Scale.Min = 0;
myPane.XAxis.Scale.Max = 12;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

脸赞 2024-07-20 08:33:25

最近遇到了同样的问题,我发现上面的答案实际上并不正确。 示例代码简单地将 XDate() 转换为 double。

但是,该示例确实强调了您需要执行的操作。 我仍然使用 DateTime.ToOADate(),但通过添加以下代码,我可以看到时间(采用 HH:MM:SS 格式):

pane.XAxis.Type = AxisType.Date;
pane.XAxis.Scale.MajorUnit = DateUnit.Hour;
pane.XAxis.Scale.Format = "T";

Having had the same problem recently, I discovered that the above answer isn't actually correct. The sample code simple casts an XDate() to a double.

However, the sample does highlight what you need to do. I still use DateTime.ToOADate(), but with the addition of the following code, I get to see times (in HH:MM:SS format):

pane.XAxis.Type = AxisType.Date;
pane.XAxis.Scale.MajorUnit = DateUnit.Hour;
pane.XAxis.Scale.Format = "T";
天气好吗我好吗 2024-07-20 08:33:25

您必须将 DateTime 变量转换为 XDate 结构。 您可以创建这样的方法:

public XDate ConvertDateToXdate(DateTime date)
{
  return new XDate(date.ToOADate);
}

这是使用 XDate 结构的图表示例

You will have to convert the DateTime variables to XDate structs. You can create a method like this:

public XDate ConvertDateToXdate(DateTime date)
{
  return new XDate(date.ToOADate);
}

Here is an example of a chart using the XDate structs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文