Chart.js. Values in a big range - Javascript Chart.js

Javascript examples for Chart.js:Chart Data

Description

Chart.js. Values in a big range

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://code.jquery.com/jquery-1.11.0.js"></script> 
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){// w w  w.jav a2s  .  com
Chart.Rectangle.prototype.inRange = function (chartX, chartY) {
    return (chartX >= this.x - this.width / 2 && chartX <= this.x + this.width / 2) && (chartY >= this.y && chartY <= (this.base + 5));
};
var barData = {
    labels: ["J", "B", "H", "S", "A"],
    datasets: [
        {
            fillColor: "rgba(153, 153, 155, 0.4)",
            highlightFill: "#7C7C7C",
            strokeColor: "#7C7C7C",
            pointColor: "#7C7C7C",
            pointStrokeColor: "#7C7C7C",
            pointHighlightFill: "#fff",
            data: [25, 94, 68, 175, 66000]
        },
        {
            fillColor: "rgba(236,166,166,0.4)",
            highlightFill: "#C3090A",
            strokeColor: "#f9090a",
            pointColor: "#fff",
            pointStrokeColor: "#C3090A",
            pointHighlightFill: "#f9090a",
            data: [134, 112, 92, 160, 52]
        }
    ]
};
var ctx = $("#bar").get(0).getContext("2d");
var myChart = new Chart(ctx).Bar(barData);
    });

      </script> 
   </head> 
   <body> 
      <canvas id="bar" width="390" height="225"></canvas>  
   </body>
</html>

Related Tutorials