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 添加数据集切换?

        时间:2023-11-01

            <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的条形顶部添加图像

                  相关文章

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

                    • <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'>