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

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

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

          <bdo id='GDsiW'></bdo><ul id='GDsiW'></ul>
      3. Chartjs 的副作用仅适用于 *一些* 客户

        Side effects from Chartjs for only *some* clients(Chartjs 的副作用仅适用于 *一些* 客户)
          <i id='A4Mu3'><tr id='A4Mu3'><dt id='A4Mu3'><q id='A4Mu3'><span id='A4Mu3'><b id='A4Mu3'><form id='A4Mu3'><ins id='A4Mu3'></ins><ul id='A4Mu3'></ul><sub id='A4Mu3'></sub></form><legend id='A4Mu3'></legend><bdo id='A4Mu3'><pre id='A4Mu3'><center id='A4Mu3'></center></pre></bdo></b><th id='A4Mu3'></th></span></q></dt></tr></i><div id='A4Mu3'><tfoot id='A4Mu3'></tfoot><dl id='A4Mu3'><fieldset id='A4Mu3'></fieldset></dl></div>
          <tfoot id='A4Mu3'></tfoot>
        1. <small id='A4Mu3'></small><noframes id='A4Mu3'>

            • <bdo id='A4Mu3'></bdo><ul id='A4Mu3'></ul>
              <legend id='A4Mu3'><style id='A4Mu3'><dir id='A4Mu3'><q id='A4Mu3'></q></dir></style></legend>

                <tbody id='A4Mu3'></tbody>

                • 本文介绍了Chartjs 的副作用仅适用于 *一些* 客户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在处理几个 Chart.js 图表,发现了一些奇怪的行为.

                  在这个小提琴中:.

                  任何线索可能导致我的浏览器和其他浏览器/计算机出现这种情况?

                  编辑,我意识到小提琴很大,所以这就是我本质上正在做的事情:

                  //分配和创建所有画布上下文var ctx = $("#graph1").get(0).getContext("2d");var ctx2 = $("#graph2").get(0).getContext("2d");var ctx3 = $("#graph3").get(0).getContext("2d");//实例化新图表并传入生成的数据var myChart = new Chart(ctx).Line(graph1Generator("day"));var myDoughnutChart = new Chart(ctx2).Doughnut(graph2Generator("day"));var myPieChart = new Chart(ctx3).Pie(graph3Generator("day"));

                  然后我添加(为每个按钮)一个事件侦听器,该侦听器销毁每个画布,并使用新信息创建一个新画布.以下是星期"按钮的示例:

                  weekButton.addEventListener("click", function(){myChart.destroy();myChart = new Chart(ctx).Line(graph2Generator("Week"));myDoughnutChart.destroy();myDoughnutChart = new Chart(ctx2).Doughnut(graph2Generator("week"));myPieChart.destroy();myPieChart = new Chart(ctx3).Pie(graph3Generator("week"));});

                  解决方案

                  我在 canvas 中定义 padding 的行为相同.我删除了 padding,现在没有调整大小.

                  I was working on a couple of Chart.js charts and have found some strange behavior.

                  In this fiddle: http://jsfiddle.net/h42tv3xv/ people have been getting a variety of side effects when pressing the buttons "Day", "Week", or "Month".

                  What it should do: Simply refresh the chart with potentially new information displayed(the pie and doughnut actually don't have anything new)

                  What it should not do: As a side effect for some, it is growing the size of the <canvas> on each click. It does it for me. But it doesn't do it for a lot of other people accessing this fiddle. Here is a screen shot:

                  Why is it doing this for some people and not others? How can I remedy this problem? If you are curious, I initially asked a question about something else about these charts, but this could be somewhat related.

                  Any clue what could be causing this in my browser and other browsers/computers?

                  Edit, I realize the fiddle is large, so this is what I am doing essentially:

                  // Assign and Create all canvas contexts 
                      var ctx = $("#graph1").get(0).getContext("2d");
                      var ctx2 =  $("#graph2").get(0).getContext("2d");
                      var ctx3 =  $("#graph3").get(0).getContext("2d");
                  
                  // Instantiate new charts and pass in generated data
                      var myChart = new Chart(ctx).Line(graph1Generator("day"));
                      var myDoughnutChart = new Chart(ctx2).Doughnut(graph2Generator("day"));
                      var myPieChart = new Chart(ctx3).Pie(graph3Generator("day"));
                  

                  then I am adding (for each button) an event listener that destroys each canvas, and creates a new one with new information. Here is an example of the "week" button:

                  weekButton.addEventListener("click", function(){
                  
                      myChart.destroy();
                      myChart = new Chart(ctx).Line(graph2Generator("Week"));
                  
                      myDoughnutChart.destroy();
                      myDoughnutChart = new Chart(ctx2).Doughnut(graph2Generator("week"));
                  
                      myPieChart.destroy();
                      myPieChart = new Chart(ctx3).Pie(graph3Generator("week"));
                  
                  
                  });
                  

                  解决方案

                  I had the same behaviour defining padding definition to my canvas. I removed padding and I have no resizing now.

                  这篇关于Chartjs 的副作用仅适用于 *一些* 客户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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='WiSrm'></small><noframes id='WiSrm'>

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

                      <tfoot id='WiSrm'></tfoot>