1. <small id='Fsptz'></small><noframes id='Fsptz'>

      <legend id='Fsptz'><style id='Fsptz'><dir id='Fsptz'><q id='Fsptz'></q></dir></style></legend>
    2. <i id='Fsptz'><tr id='Fsptz'><dt id='Fsptz'><q id='Fsptz'><span id='Fsptz'><b id='Fsptz'><form id='Fsptz'><ins id='Fsptz'></ins><ul id='Fsptz'></ul><sub id='Fsptz'></sub></form><legend id='Fsptz'></legend><bdo id='Fsptz'><pre id='Fsptz'><center id='Fsptz'></center></pre></bdo></b><th id='Fsptz'></th></span></q></dt></tr></i><div id='Fsptz'><tfoot id='Fsptz'></tfoot><dl id='Fsptz'><fieldset id='Fsptz'></fieldset></dl></div>
        • <bdo id='Fsptz'></bdo><ul id='Fsptz'></ul>
        <tfoot id='Fsptz'></tfoot>
      1. Chart.js 忽略画布高度和宽度

        Chart.js ignoring canvas height amp; width(Chart.js 忽略画布高度和宽度)

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

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

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

                  本文介绍了Chart.js 忽略画布高度和宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  遵循 Chart.js 文档我正在尝试绘制一个小图表:

                  Following the Chart.js documentation I am trying to draw a small chart:

                  <canvas id="myChart" width="400" height="400"></canvas>
                  <script>
                  var ctx = document.getElementById("myChart");
                  var myChart = new Chart(ctx, {
                    type: 'line',
                    data: {
                      labels:['15-2016','16-2016','17-2016',],
                      datasets:[
                        {
                          label:'Yes',
                          data:[3.4884,1.1628,1.3514,],
                          backgroundColor:'rgba(75,192,192,1)',
                          borderColor:'rgba(75,192,192,1)',
                          pointRadius:0
                        },
                        {
                          label:'Maybe',
                          data:[0.5571,1.3298,0.791,],
                          backgroundColor:'rgba(255,206,86,1)',
                          borderColor:'rgba(255,206,86,1)',
                          pointRadius:0
                        },
                        {
                          label:'No',
                          data:[0,0,0,],
                          backgroundColor:'rgba(255,99,132,1)',
                          borderColor:'rgba(255,99,132,1)',
                          pointRadius:0
                        }
                      ]
                    }        
                  });
                  </script>
                  

                  但是,当页面被渲染时,画布会以某种方式变成

                  However, when the page is rendered the canvas somehow becomes

                  <canvas style="height: 929px; width: 929px;" id="myChart" width="1858" height="1858"></canvas>
                  

                  这对我的需要来说太大了.如何将画布的宽度和高度设置为我想要的?

                  which is waaaaay too big for my needs. How can I set the width and height of the canvas to be what I want?

                  推荐答案

                  我可以通过关闭响应来硬编码图表的大小:

                  I was able to hardcode the size of the graph by turning off responsiveness:

                  options: {
                    responsive: false
                  }
                  

                  这篇关于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 栏中隐藏值)

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

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

                            <tbody id='SmH6Z'></tbody>