如何在Chart.JS V2中修改类别标签的字体大小?

纳比尔·卡迪米(Nabil Kadimi)

我正在使用Chart.JS V2,但找不到改变类别标签(演示中的动物,科学和文化)的字体大小的方法:

下面JSFiddle中的代码和演示

谢谢。

jQuery(document).ready(function($) {
  new Chart(document.getElementById("so"), {
    type: "radar",
    data: {
      labels: ["Animals", "Science", "Culture"],
      datasets: [{
        label: '',
        data: [46, 51, 29]
      }, {
        label: '',
        data: [0, 0, 0]
      }]
    },
    options: {
      scale: {
        ticks: {
          min: 0,
          max: 100,
          max: 100,
          stepSize: 20,
          beginAtZero: true
        },
      },
      legend: {
        display: false
      }
    }
  });
});
canvas {
  max-width: 400px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.js'></script>

<canvas id='so'></canvas>

阿尼尔·萨马尔(Anil Samal)

这样做:

  new Chart(document.getElementById("so"), {
type: "radar",
data: {
  labels: ["Animals", "Science", "Culture"],
  datasets: [{
    label: '',
    data: [46, 51, 29]
  }, {
    label: '',
    data: [0, 0, 0]
  }]
},
options: {
  scale: {
    ticks: {
      min: 0,
      max: 100,
      max: 100,
      stepSize: 20,
      beginAtZero: true
    },
    pointLabels: { fontSize:18 }
  },
  legend: {
    display: false
  }
} });

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章