Format x axis to show percent with Primefaces/Chartjs ScatterChart

๐Ÿ‘:-2

                  scales: {
                 yAxes: [{
                    display: true,
                    scaleLabel: {
                       display: true
                    },
                    ticks: {
                       // add % to y axis label
                       callback: function (value, index, values) {
                           value = value * 100;
                           value = value.toFixed(2);
                           return value + " %";
                       }
                    }
                 }],
                 xAxes: [{
                        ticks: {
                           // add % to x axis label
                           callback: function (value, index, values) {
                               value = value * 100;
                               value = value.toFixed(2);
                               return value + " %";
                           }
                        }
                     }]
              }

Leave a comment