Asp.net Bar Chart with Datatable Columns as X Axis - Javascript Google Chart

Javascript examples for Google Chart:Column Chart

Description

Asp.net Bar Chart with Datatable Columns as X Axis

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>An Example of a Google Bar Chart</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> 
      <div id="chart_div"></div> 
      <script type="text/javascript">
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawStacked);
function drawStacked() {/*from w w w. j av a2 s  .  c o m*/
      var data = new google.visualization.DataTable();
      data.addColumn('string', 'Score');
      data.addColumn('number', 'Frequency');
      data.addRows([
        ['CPass ', 3],
        ['CFail ', 3],
        ['WPass ', 0],
        ['WFail ', 0],
        ['HPass ', 5],
        ['HFail  ', 2],
        ['APass ', 0],
        ['AFail ', 0]
      ]);
      var options = {
        title: 'Scoring system',
        isStacked: true,
        hAxis: {
          title: 'Score',
        },
        vAxis: {
          title: 'Frequency'
        }
      };
      var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
      chart.draw(data, options);
    }

      </script>  
   </body>
</html>

Related Tutorials