1. <legend id='HpbDz'><style id='HpbDz'><dir id='HpbDz'><q id='HpbDz'></q></dir></style></legend>

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

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

      2. <tfoot id='HpbDz'></tfoot>
        • <bdo id='HpbDz'></bdo><ul id='HpbDz'></ul>
      3. 如何向 Chart.js 添加数据集切换?

        How to add a dataset toggle to Chart.js?(如何向 Chart.js 添加数据集切换?)

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

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

                  <bdo id='uSBUD'></bdo><ul id='uSBUD'></ul>
                • <legend id='uSBUD'><style id='uSBUD'><dir id='uSBUD'><q id='uSBUD'></q></dir></style></legend>
                  <tfoot id='uSBUD'></tfoot>
                • 本文介绍了如何向 Chart.js 添加数据集切换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I'm using Chart.js to create a line chart. I would like to have four different datasets that will all be visibile by default, but can be toggled on and off by clicking a button. How can this be achieved? I can't seem to find an answer in the documentation. .addData(), .removeData() and .update() all seem to be used for adding or removing values to existing datasets, but not adding or removing entire datasets. I would think this would be fairly commonly used feature but I can't find an answer anywhere.

                  解决方案

                  After thoroughly researching this, there doesn't appear to be any built in function to toggle entire datasets. I used the .destroy() function to remove the entire existing chart, and then some logic to redraw it with the necessary datasets.

                  EDIT: Here's a fiddle with my full code if it's helpful to anyone -> http://jsfiddle.net/21xg27kr/4/

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

                  • <legend id='i74tV'><style id='i74tV'><dir id='i74tV'><q id='i74tV'></q></dir></style></legend>

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

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