<legend id='41c65'><style id='41c65'><dir id='41c65'><q id='41c65'></q></dir></style></legend>

  • <tfoot id='41c65'></tfoot>

    <small id='41c65'></small><noframes id='41c65'>

    <i id='41c65'><tr id='41c65'><dt id='41c65'><q id='41c65'><span id='41c65'><b id='41c65'><form id='41c65'><ins id='41c65'></ins><ul id='41c65'></ul><sub id='41c65'></sub></form><legend id='41c65'></legend><bdo id='41c65'><pre id='41c65'><center id='41c65'></center></pre></bdo></b><th id='41c65'></th></span></q></dt></tr></i><div id='41c65'><tfoot id='41c65'></tfoot><dl id='41c65'><fieldset id='41c65'></fieldset></dl></div>

      • <bdo id='41c65'></bdo><ul id='41c65'></ul>

        Chart.js yAxes Ticks stepSize 不起作用(小提琴)

        时间:2023-11-02
          <tfoot id='0FK1K'></tfoot>

          <i id='0FK1K'><tr id='0FK1K'><dt id='0FK1K'><q id='0FK1K'><span id='0FK1K'><b id='0FK1K'><form id='0FK1K'><ins id='0FK1K'></ins><ul id='0FK1K'></ul><sub id='0FK1K'></sub></form><legend id='0FK1K'></legend><bdo id='0FK1K'><pre id='0FK1K'><center id='0FK1K'></center></pre></bdo></b><th id='0FK1K'></th></span></q></dt></tr></i><div id='0FK1K'><tfoot id='0FK1K'></tfoot><dl id='0FK1K'><fieldset id='0FK1K'></fieldset></dl></div>
          • <legend id='0FK1K'><style id='0FK1K'><dir id='0FK1K'><q id='0FK1K'></q></dir></style></legend>
            • <bdo id='0FK1K'></bdo><ul id='0FK1K'></ul>

                  <small id='0FK1K'></small><noframes id='0FK1K'>

                    <tbody id='0FK1K'></tbody>

                1. 本文介绍了Chart.js yAxes Ticks stepSize 不起作用(小提琴)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经为 yAxis 创建了一个带有这些选项的折线图:

                  yAxes: [{滴答声:{精度:1,步长:18.1,分钟:148.5,最大值:220.9}}]

                  因此,我希望 yAxis 可以这样缩放:

                  220.9202.8184.7166.6148.5

                  但是,当我提供此代码时,我正在获取此数据.

                  请看这个小提琴的例子:


                  另一种方法是使用 suggestedMinsuggestedMax 而不是 minmax,这允许 Chart.js计算自己的minmax:

                  在你的情况下,你只需要申请:

                  yAxes: [{滴答声:{maxTicksLimit: 5,建议Min: 148.5,建议最大值:220.9,步长:18.1,},}]

                  I have created a line chart with these options for the yAxis:

                  yAxes: [{
                      ticks: {
                          precision: 1,
                          stepSize: 18.1,
                          min: 148.5,
                          max: 220.9
                      }
                  }]
                  

                  I would like, therefore, the yAxis scales to be like this:

                  220.9
                  202.8
                  184.7
                  166.6
                  148.5
                  

                  However, when I provide this code, I am getting this data.

                  Please see this fiddle for an example: https://jsfiddle.net/wxLzdrcm/

                  How can I make the yAxis ticks add up like I have described?

                  解决方案

                  This question was asked at least twice (1, 2).

                  The solution is to use min and max values so that stepSize is a factor of max - min, allowing the chart to actually use the specified stepSize:

                  yAxes: [{
                    ticks: {
                      maxTicksLimit: 5,
                      min: 144.8, // 18.1 * 8
                      max: 235.3, // 18.1 * 13
                      stepSize: 18.1,
                    },
                  }]
                  


                  An alternative would be using suggestedMin and suggestedMax rather than min and max, which allows Chart.js to calculate its own min and max:

                  In your case, you just need to apply:

                  yAxes: [{
                    ticks: {
                      maxTicksLimit: 5,
                      suggestedMin: 148.5,
                      suggestedMax: 220.9,
                      stepSize: 18.1,
                    },
                  }]
                  

                  这篇关于Chart.js yAxes Ticks stepSize 不起作用(小提琴)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:chartJS v.2 上的圆角 - 条形图(带负值) 下一篇:如何在chartjs中扩展圆环图的切片?

                  相关文章

                2. <i id='Ic4oV'><tr id='Ic4oV'><dt id='Ic4oV'><q id='Ic4oV'><span id='Ic4oV'><b id='Ic4oV'><form id='Ic4oV'><ins id='Ic4oV'></ins><ul id='Ic4oV'></ul><sub id='Ic4oV'></sub></form><legend id='Ic4oV'></legend><bdo id='Ic4oV'><pre id='Ic4oV'><center id='Ic4oV'></center></pre></bdo></b><th id='Ic4oV'></th></span></q></dt></tr></i><div id='Ic4oV'><tfoot id='Ic4oV'></tfoot><dl id='Ic4oV'><fieldset id='Ic4oV'></fieldset></dl></div>
                    <legend id='Ic4oV'><style id='Ic4oV'><dir id='Ic4oV'><q id='Ic4oV'></q></dir></style></legend>

                      • <bdo id='Ic4oV'></bdo><ul id='Ic4oV'></ul>

                      <tfoot id='Ic4oV'></tfoot>

                      <small id='Ic4oV'></small><noframes id='Ic4oV'>