score:2

Accepted answer

using chart.js, you can set the background color of a pie chart with the backgroundcolor attribute:

{
  type: 'pie',
  data: {
    labels: ['high', 'medium', 'low'],
    datasets: [{
      data: [50, 60, 70],
      backgroundcolor: ['#4e73df', '#0f3dc4', '#9fb4f3']
    }]
  }
}

additionally, you may want to change the color of the labels using the datalabels plugin:

{
  type: 'pie',
  data: {
    labels: ['high', 'medium', 'low'],
    datasets: [{
      data: [50, 60, 70],
      backgroundcolor: ['#4e73df', '#0f3dc4', '#9fb4f3']
    }]
  },
  options: {
    plugins: {
      datalabels: {
        color: '#fff'
      }
    }
  }
}

pack it into the chart url:

https://quickchart.io/chart?bkg=white&c=%7btype%3a%27pie%27%2cdata%3a%7blabels%3a%5b%27high%27%2c%27medium%27%2c%27low%27%5d%2cdatasets%3a%5b%7bdata%3a%5b50%2c60%2c70%5d%2cbackgroundcolor%3a%5b%27%234e73df%27%2c%27%230f3dc4%27%2c%27%239fb4f3%27%5d%7d%5d%7d%2coptions%3a%7bplugins%3a%7bdatalabels%3a%7bcolor%3a%27%23fff%27%7d%7d%7d%7d

and it will look like this:

quickchart pie chart


More Query from same tag