chart js无法更改标签的点宽和点高

xhv8bpkk  于 2022-12-18  发布在  Chart.js
关注(0)|答案(1)|浏览(103)

我有这个设置

const options = {
  responsive: true,
  plugins: {
    legend: {
      position: 'bottom',
      labels: {
        usePointStyle: true,
        pointStyle: 'circle',
        // fontSize: 2,
        // boxWidth: 6,
        // pointStyleWidth: 10,
        template: {
          maxWidth: 10,
        },
      },
    },
    title: {
      display: false,
    },
  },
}
const data = {
  labels: ['E-commerce', 'Enterprise', 'Yellow', 'Green', 'Purple'],
  datasets: [
    {
      label: '# of Votes',
      data: [12, 19, 3, 5, 3],
      backgroundColor: ['#C07CC3', '#9C3848', '#9DDBAD', '#ADA8B6', '#606EDA'],
      borderWidth: 1,
    },
  ],
}

我得到了这个设置的图表

我想使点变小,但当我取消注解pointStyleWidth属性时,宽度变小,但高度保持不变
像这样

pzfprimi

pzfprimi1#

我发现,我需要boxWidthboxHeight,并删除pointStyleWidth

相关问题