1. <tfoot id='6MWiG'></tfoot>
      <legend id='6MWiG'><style id='6MWiG'><dir id='6MWiG'><q id='6MWiG'></q></dir></style></legend>
    2. <small id='6MWiG'></small><noframes id='6MWiG'>

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

        Chartjs 隐藏数据集图例 v3

        时间:2023-11-02
          <bdo id='jZkVW'></bdo><ul id='jZkVW'></ul>

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

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

                  <tfoot id='jZkVW'></tfoot>
                • 本文介绍了Chartjs 隐藏数据集图例 v3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我当前在网页上的图表由 Chart.js v2.5.3 提供支持.不久前配置的图表工作得很好.代码如下:

                  My current graphs on the webpage are powered by Chart.js v2.5.3. Charts that were configured a while ago works perfectly fine. Here is the code:

                  var ctw = document.getElementById("chart-budget");
                  var myChart = new Chart(ctw, {
                    type: 'bar',
                    data: {
                      labels: ["budget", "costs"],
                      datasets: [{
                        label: "Amount",
                        data: [520980, 23397.81],
                        backgroundColor: [
                          'rgba(143, 211, 91, 0.2)',
                          'rgba(255, 99, 132, 0.2)',
                        ],
                        borderColor: [
                          'rgba(143, 211, 91,1)',
                          'rgba(255, 99, 132, 1)',
                        ],
                        borderWidth: 1
                      }]
                    },
                    options: {
                      legend: {
                        display: false
                      },
                      responsive: true,
                      scales: {
                        yAxes: [{
                          ticks: {
                            beginAtZero: true
                          },
                          gridLines: {
                            drawBorder: false,
                          }
                        }],
                        xAxes: [{
                          gridLines: {
                            display: false,
                          }
                        }]
                      }
                    }
                  });         
                  
                              
                  

                  由于 v3 现在可用,我正在考虑切换到它.快速测试揭示了一些我需要克服的问题.我正在努力解决的问题之一是无法隐藏数据集图例.在 V2.5 中,它是通过将 options.legend.display 设置为 false 来完成的,但不再是.在 文档中,我没有遇到任何可以帮助我的东西.

                  As v3 is now available I was thinking to switch to it. A quick test revealed some issues I will need to overcome. One of the issue I'm struggling with is unability to hide dataset legend. In V2.5 it was done by options.legend.display set to false but not any longer. In the documentation I did not come across anything that could help me.

                  有没有人可以建议如何在 Chart.js V3 中隐藏图例?

                  Is there anyone who can advice on how to hide a legend in Chart.js V3?

                  /库巴

                  推荐答案

                  配置如下选项可以解决V3版本的问题.

                  Configuring option like below would solve the problem in V3 version.

                  options: { plugins: { legend: { display: false }, } }
                  

                  这篇关于Chartjs 隐藏数据集图例 v3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:chartjs 时间笛卡尔轴适配器和日期库设置 下一篇:Chart.js - 在折线图中为背景的特定部分着色

                  相关文章

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

                    <legend id='1LuWD'><style id='1LuWD'><dir id='1LuWD'><q id='1LuWD'></q></dir></style></legend>

                      <small id='1LuWD'></small><noframes id='1LuWD'>