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

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

      1. Chart.js 为比例添加填充

        Chart.js add padding to scales(Chart.js 为比例添加填充)

        • <tfoot id='r2INh'></tfoot>

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

                  <tbody id='r2INh'></tbody>
                  <bdo id='r2INh'></bdo><ul id='r2INh'></ul>
                  <legend id='r2INh'><style id='r2INh'><dir id='r2INh'><q id='r2INh'></q></dir></style></legend>
                • <small id='r2INh'></small><noframes id='r2INh'>

                • 本文介绍了Chart.js 为比例添加填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要在 x 和 y 轴上添加填充.这个问题(How to add padding betweenchart.js 中的图形和 X/Y 比例?)是我的确切情况,只有我使用的是 Chart.js 2.

                  见截图:http://i.imgur.com/2BvlZDg.pngp>

                  基本上我的观点是大图,所以它们超出了图表范围.有没有办法为图表区域或比例添加填充以使其更适合?

                  解决方案

                  想出了一个使用 yAxes 的方法:

                  选项:{秤:{y轴:[{滴答声:{填充:100}}],}}

                  目前在 x 轴上没有解决方案.解决您的问题的方法可能是通过计算数据的最小值并加上减去增量值来设置较低的最小值:

                  yAxes: [{滴答声:{分钟:-100}}],

                  两者都会是这样的:https://jsfiddle.net/u9b0nmp8/1/

                  更新 #1:X 轴建议

                  更新 #2:改进的 x 轴替代方案基于https://stackoverflow.com/a/38620312/6638478

                  更新 #3:2.7 版及更高版本现在支持 y 轴和 x 轴上的填充.示例:https://jsfiddle.net/u9b0nmp8/207/

                  I need to add padding on the x and y axis. This question (How to add padding between Graph and X/Y-Scale in chart.js?) is my exact situation, only I am using Chart.js 2.

                  See screeshot: http://i.imgur.com/2BvlZDg.png

                  Basically my points are large images, so they are running off the chart. Is there a way to add padding to the chart area or scales so they fit better?

                  解决方案

                  Figured out a way to do it with the yAxes:

                  options: {
                      scales: {
                          yAxes: [{
                              ticks: {
                                  padding: 100
                              }
                          }], 
                      }
                  }
                  

                  No solution so far on the x axis. A workaround to your problem though could be to set a lower min by calculating the min of the data and adding subtracting a increment value:

                  yAxes: [{
                      ticks: {
                          min: -100
                      }
                  }], 
                  

                  Both togheter would be something like this: https://jsfiddle.net/u9b0nmp8/1/

                  Update #1: X-axis suggestion

                  Update #2: improved alternative to the x-Axis based on https://stackoverflow.com/a/38620312/6638478

                  Update #3: version 2.7 and up now supports padding on both y and x axis. Example: https://jsfiddle.net/u9b0nmp8/207/

                  这篇关于Chart.js 为比例添加填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  ChartJS Version 3 - common legend for multiple line charts(ChartJS 版本 3 - 多个折线图的常用图例)
                  Charts.js scales yaxes ticks min max doesnt work(Charts.js 缩放 yaxes 刻度 min max 不起作用)
                  How to expand the slice of donut chart in chartjs?(如何在chartjs中扩展圆环图的切片?)
                  Chart.js yAxes Ticks stepSize not working (fiddle)(Chart.js yAxes Ticks stepSize 不起作用(小提琴))
                  Rounded corners on chartJS v.2 - bar charts (with negative values)(chartJS v.2 上的圆角 - 条形图(带负值))
                  How to hide value in Chart JS bar(如何在 Chart JS 栏中隐藏值)

                  <tfoot id='JlRaM'></tfoot>

                  <legend id='JlRaM'><style id='JlRaM'><dir id='JlRaM'><q id='JlRaM'></q></dir></style></legend>

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

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