Диаграмма JS. Как выровнять текст по центру всплывающей подсказки? - PullRequest
0 голосов
/ 01 ноября 2018

bodyAlign и titleAlign не работают, может кто-нибудь знает, как выровнять текст по центру всплывающей подсказки?

enter image description here

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
   }
  }
});

1 Ответ

0 голосов
/ 01 ноября 2018

Ваши align properties все испортили. Попробуйте это:

https://jsfiddle.net/m7s43hrs/2951/

...