您如何在X轴上更正ApexCharts DateTime范围?

发布于 2025-01-18 08:51:54 字数 743 浏览 2 评论 0 原文

我已经在Vanilla JavaScript中使用ApexCharts创建了一个线图。串联值具有相应的日期,但由于某种原因,3月份被排除在X轴日期标签之外。

示例数据:

  series: [
    {
      name: "Parker, D (1250)",
      data: [
        { x: "28-Feb-2017 GMT", y: 34 },
        { x: "31-Mar-2017 GMT", y: 43 },
        { x: "30-Apr-2017 GMT", y: 31 },
        { x: "31-May-2017 GMT", y: 43 },
        { x: "30-Jun-2017 GMT", y: 33 },
        { x: "31-Jul-2017 GMT", y: 52 }
      ]
    }

输出:

“在此处输入映像”

出于某种原因,图表正在绘制第一个数据点(日期为日期2月28日的2月1日,我想要的预期行为是3月1日的日期轴。

这是任何人都可以玩:

有人知道如何解决此问题吗?

I've created a Line graph using Apexcharts in vanilla javascript. The series values have corresponding dates, but for some reason, the month of march is left out of the x axis date labels.

The sample data:

  series: [
    {
      name: "Parker, D (1250)",
      data: [
        { x: "28-Feb-2017 GMT", y: 34 },
        { x: "31-Mar-2017 GMT", y: 43 },
        { x: "30-Apr-2017 GMT", y: 31 },
        { x: "31-May-2017 GMT", y: 43 },
        { x: "30-Jun-2017 GMT", y: 33 },
        { x: "31-Jul-2017 GMT", y: 52 }
      ]
    }

The output:

enter image description here

For some reason, the chart is plotting the first data point (with date of 28th of Feb) directly above the date 1st of Feb. The expected behaviour that I would like is the date axis to say 1st of March instead.

Here's the codepen for anyone to have a play with: https://codepen.io/shane-wood/pen/zYpGxrY?editors=0010

Does anyone know how to fix this issue?

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

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

发布评论

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

评论(1

勿忘初心 2025-01-25 08:51:54

我也在观察类似的问题。您可能遇到时区问题,请从那时起仔细检查。此外,Apexchart 很少出现图表显示错误时区的问题,这可以在图表选项中进行配置。

请检查
https://github.com/apexcharts/apexcharts.js/issues/958
https://github.com/apexcharts/apexcharts.js/issues/110

I was observing similar issue on my side. You probably have issues with timezones, please double check from that point. Also there were few Apexchart issues with chart showing wrong timezone, which could be configurable in charts options.

Please check
https://github.com/apexcharts/apexcharts.js/issues/958
https://github.com/apexcharts/apexcharts.js/issues/110

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