如何删除极地面积图的刻度线或内圈 Chart.js

How do I remove the ticks or inner circles of my polar area chart Chart.js

我已经在 Jquery 中编写了我的图表代码,我正在使用图表在我的 Django 网页上显示数据,我想删除我认为称为刻度的内圈以及与它们一起显示的小数字。我试过使用

刻度:{ 显示:假的, }

规模:{ 显示:假的, }

但都没有运气,我不知道该怎么做。

图表代码:

            new Chart("chart_{{ i.pk }}_{{ t.pk }}", {
              type: "polarArea",
              data: {
                labels: labels_{{ t.pk }},
                datasets: [{
                  fill: true,
                  pointRadius: 1,
{#                  borderColor: backgroundColors_{{ t.pk }} ,#}
                  backgroundColor: backgroundColors_{{ t.pk }} ,
                  data: totals_{{ i.pk }}_{{ t.pk }}_arr,
                }]
              },
              options: {
                responsive: false,
                maintainAspectRatio: true,
                plugins: {
                    legend: {
                        display: false,
                    },
                    scale: {
                        ticks: {
                            display: false,
                        },
                        gridLines: {
                                display: false,
                                lineWidth: 7,
                                tickMarkLength: 30// Adjusts the height for the tick marks area
                        },
                        
                    },
                    title: {
                        display: false,
                        text: 'Chart.js Polar Area Chart'
                    }
                }
              }
            });

        {% endfor %}
    {% endfor %}
{% endblock %}

在 v3 中,不再在 scale 对象中配置 radialLinear 比例尺,而是在 scales 命名空间中配置径向线命名空间 r。此外,它不应在插件部分中配置,而应在选项对象的根目录中配置。 最后,gridLines 已重命名为 grid

对于 V2 和 V3 之间的所有变化,请阅读 migration guide

实例:

const options = {
  type: 'polarArea',
  data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [{
      label: '# of Votes',
      data: [12, 19, 3, 5, 2, 3],
      backgroundColor: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"]
    }]
  },
  options: {
    scales: {
      r: {
        ticks: {
          display: false // Remove vertical numbers
        },
        grid: {
          display: false // Removes the circulair lines
        }
      }
    }
  }
}

const ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
<body>
  <canvas id="chartJSContainer" width="600" height="400"></canvas>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.0/chart.js"></script>
</body>