Search code examples
vue-chartjs

Change color of labels vue-chartjs


How can I change the default colour of the labels?

Here is default chart implementation, hope someone can help me

<script>
import { Pie} from 'vue-chartjs'

export default Pie.extend({

  props: ['one', 'two', 'three'],

    mounted () {
    // Overwriting base render method with actual data.
    this.renderChart({
      labels: ['One', 'Two', 'Three'],

      datasets: [
        {
          label: 'Stuff',
          backgroundColor: ['#C28535', '#8AAE56', '#B66C46'],
          data: [this.one, this.two, this.three]
        }
      ]
    })
    }
    })
    </script>

Cheers


Solution

  • Check the Chart.js docs http://www.chartjs.org/docs/#chart-configuration-tooltip-configuration

    I guess you mean the labels in the legend ? Or Toolip? Either way, you have to pass the object as options.