Chartjs Scale Numbers - Javascript Chart.js

Javascript examples for Chart.js:Chart Configuration

Description

Chartjs Scale Numbers

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://rawgit.com/nnnick/Chart.js/v1.0.2/Chart.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from w  ww .  jav  a2s.  c om
var data = {
    labels: ["January", "February", "March", "April", "May", "June", "July"],
    datasets: [
        {
            label: "My First dataset",
            fillColor: "rgba(220,220,220,0.5)",
            strokeColor: "rgba(220,220,220,0.8)",
            highlightFill: "rgba(220,220,220,0.75)",
            highlightStroke: "rgba(220,220,220,1)",
            data: [65, 59, 80, 81, 56, 55, 40]
        }
    ]
};
var ctx = document.getElementById("myChart").getContext("2d");
var min = Infinity;
var myBarChart = new Chart(ctx).Bar(data, {
    scaleLabel: function(e) {
        if (Number(e.value) < min)
            min = Number(e.value);
        if (Number(e.value) === min)
            return '$';
        else
            return e.value;
    },
});
    }

      </script> 
   </head> 
   <body> 
      <canvas id="myChart" height="400" width="400"></canvas>  
   </body>
</html>

Related Tutorials