最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Decimals in x axis only showing 0s and not rounding properly in ApexCharts, also "stepSize" not w

programmeradmin2浏览0评论

I'm attempting to create a line graph that should show an x and y axis that are both numbers to the second decimal. Say I pass a min of 0.0345 and a max of 5.2345, I would expect the first number on the x axis to be 0.035 and the last number on the x axis to be 5.23, however it shows me 0.00 and 6.00, why is this happening?

here is the xaxis portion of my chart options:

        xaxis: {
          type: 'category',
          categories: [],
          min: this.min,
          max: this.max,
          stepSize: 0.5,
          title: {
            text: 'Label'
          },
          labels: {
            formatter: function (val) {
              return val.toFixed(2);
            }
          },
        }

Another thing that's happening is that the stepSize option doesn't do anything! I am trying to do steps by .5 but it still steps up by whole integers. Any idea why?

Can share whatever code is relevant, let me know

I'm attempting to create a line graph that should show an x and y axis that are both numbers to the second decimal. Say I pass a min of 0.0345 and a max of 5.2345, I would expect the first number on the x axis to be 0.035 and the last number on the x axis to be 5.23, however it shows me 0.00 and 6.00, why is this happening?

here is the xaxis portion of my chart options:

        xaxis: {
          type: 'category',
          categories: [],
          min: this.min,
          max: this.max,
          stepSize: 0.5,
          title: {
            text: 'Label'
          },
          labels: {
            formatter: function (val) {
              return val.toFixed(2);
            }
          },
        }

Another thing that's happening is that the stepSize option doesn't do anything! I am trying to do steps by .5 but it still steps up by whole integers. Any idea why?

Can share whatever code is relevant, let me know

Share Improve this question asked Nov 21, 2024 at 1:23 rovacrovac 2,1036 gold badges30 silver badges59 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I FIGURED IT OUT!!! The type has to be set to numeric, found the answer in an old apexcharts bug report from 2021 LOL

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论