Google Charts vertical axis in whole numbers - Javascript Google Chart

Javascript examples for Google Chart:Axis

Description

Google Charts vertical axis in whole numbers

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> 
      <script type="text/javascript">
      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawVisualization);
      function drawVisualization() {
        var data = google.visualization.arrayToDataTable([
          [ 'Signals', 'Count', { role: 'style' }],
          [ 'Agreements' , 6, 'blue' ],
          [ 'ProductsMarkets' , 3, 'blue' ],
          [ 'DebtEquity' , 1, 'blue' ],
          [ 'Executive' , 1, 'blue' ],
          [ 'Securities' , 1, 'blue' ]]);
    var options = {/*from w  ww.j av  a  2  s . c om*/
         title : 'Signals',
         vAxis : { title : 'Signals' },
         hAxis : { title : 'Count', ticks: [0, 4, 8] },
         bars: 'horizontal',
         bar : { groupWidth : "95%" },
         legend : { position : "none" }
    };
    var chart = new google.visualization.BarChart(document.getElementById('signals'));
    chart.draw(data, options);
    }
    
      </script> 
   </head> 
   <body> 
      <div id="signals" style="width: 900px; height: 500px;"></div>  
   </body>
</html>

Related Tutorials