.net 4.0图表控件自定义网格线

发布于 2024-09-27 14:29:47 字数 116 浏览 1 评论 0原文

是否可以自定义网格线的显示方式。我有两张图表,一张显示每日数据 - 以时间为 x 轴。我希望网格线按整点显示,或者例如每 2 小时显示一次。在第二个图表中,x 轴跨越日期范围,因此我希望网格线代表每天,例如每 5 天。

Is it possible to customise how the grid lines appear. I have two charts one shows daily data - with Time as x axis. I would like grid-line to show on the hour or for example every 2 hours. In the second chart the x axis is across a date range so I would like grid-line to be for every day or for example every 5 days.

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

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

发布评论

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

评论(1

一张白纸 2024-10-04 14:29:47

您可以设置 ChartArea 的 AxisX 的 IntervalType 和 Interval 属性:

chart.ChartAreas[0].AxisX = new Axis() {
    IntervalType = DateTimeIntervalType.Hours,
    Interval = 2
};

chart.ChartAreas[0].AxisX = new Axis() {
    IntervalType = DateTimeIntervalType.Days,
    Interval = 5
};

You can set the ChartArea's AxisX's IntervalType and Interval properties:

chart.ChartAreas[0].AxisX = new Axis() {
    IntervalType = DateTimeIntervalType.Hours,
    Interval = 2
};

chart.ChartAreas[0].AxisX = new Axis() {
    IntervalType = DateTimeIntervalType.Days,
    Interval = 5
};
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文