1

I have a chart with two yAxes. The right one is displayed in % but the datasets have values like [0.23, 0.7,..] and not [23%,70%,..].

So I want to display the tooltips and labels (chartjs-plugin-datalabels)of the datasets belonging o the 'percent' Axis in percent but not the ones belonging to the other yAxis. How do I do this?

parasails.registerComponent('chart', {

props: {

        chartData: Array,

        title: String,

        yAxes: Array

},

data: function (){

     supportedAxes: {

            percentAxis : {

                id: 'percent',

                type: 'linear',

                position: 'right',

                scaleLabel: {

                    display: true,

                    labelString: 'PERCENT',

                },

                ticks: {

                    callback: function (value) {

                        return (value * 100).toFixed(1) + '%'; // convert it to percentage

                    }

                }

            },

            hoursAxis : {

                id: 'hours',

                type: 'linear',

                scaleLabel: {

                    display: true,

                    labelString: 'HOURS'

                }

                //position: 'left'

            }



     }

},

methods: {

var options = {

plugins:{

                    datalabels:{

                        display: this.displayDatalabels

                    }

}

}
aleina
  • 11
  • 1

0 Answers0