Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49171

Format label chartjs

$
0
0

@fillah wrote:

Hey guys.

I'm using chart.js and trying to format the y-axis label from 25000 to 25.000 $.
I've read several pages about either set the default to this:

 Chart.defaults.global.scaleLabel = function(label){
    return label.value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
};

or set the options:

var options = {
        animation: false,
        scaleLabel:
        function(label){return  ' $' + label.value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");}

    };

or scope the options on html with options="options". But nothing works. Some of my code looks line thise, where i define the data and type of the chart.

var loadCharts = function(){
                    var ctx = document.getElementById("lineChart");
                    var myChart = new Chart(ctx, {
                      type: 'line',
                      data: data
                    });;
                };

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49171

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>