小编Дим*_*аев的帖子

图表.js. 如何按工具提示的中心对齐文本?

bodyAlign 和 titleAlign 不起作用,也许有人知道如何通过工具提示中心对齐文本?

在此输入图像描述

https://jsfiddle.net/Dima1501/m7s43hrs/2900/

var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
  type: 'doughnut',
  data: {
    labels: ["Red", "Blue", "Yellow"],
    datasets: [{
      label: '# of Votes',
      data: [12, 19, 3],
      backgroundColor: [
      ],
      borderColor: [
      ],
      borderWidth: 1
    }]
  },
 options: {
    tooltips: {
    yAlign: 'bottom',
            xAlign: 'center',
    xPadding: 25,
            yPadding: 15,
      xPadding: 45,
      titleAlign: 'center',
            footerAlign: 'center',
            bodyAlign: 'center',
  callbacks: {
  },
  backgroundColor: '#ccc',
  titleFontSize: 16,
  titleFontColor: '#0066ff',
  bodyFontColor: '#000',
  bodyFontSize: 14,
  displayColors: false
   }
  } …
Run Code Online (Sandbox Code Playgroud)

javascript canvas chart.js chartjs-2.6.0

8
推荐指数
2
解决办法
9152
查看次数

标签 统计

canvas ×1

chart.js ×1

chartjs-2.6.0 ×1

javascript ×1