Chartjs - 为标签雷达图添加backgroundColor

时间:2017-12-27 08:34:41

标签: javascript chart.js

>>> Radar chart labels with background color

您好,我只想要一个选项,为Chartjs中的标签(单独)添加背景颜色(带有bg颜色的圆角矩形)。有没有我可以申请更改这个回调,任何帮助都表示最诚挚的问候!

这是当前的代码:

let chart = new Chart('chart-0', {
  type: 'radar',
  data: radarChartData,
  options: {
    responsive: true,
    legend: {
      position: 'top',
    },
    title: {
      display: true,
      text: 'Radar Chart | Chart.js',
      fontSize: 16
    },
    scale: {
      ticks: {
        beginAtZero: true
      },
      pointLabels: {
        fontSize: 14, // fontSize is ok
        fontColor: presets.blue, // fontColor is accessible
        backgroundColor: presets.yellow //This is not working for sure!
      }
    },
    animation: {
        animateScale: true,
        animateRotate: true
    }
  }
});

2 个答案:

答案 0 :(得分:0)

您可以使用backgroundColor。

.btn-primary, .btn-primary:hover, .btn-primary:active, .btn-primary:visited, .btn-primary:focus, .btn-primary:active:focus {
background-color: #8064A2;}

答案 1 :(得分:0)

如果有人需要答案,我确实在chartjs中发布了帖子并且Tim做得很好:https://github.com/chartjs/Chart.js/issues/5085

Rgrds,