An Example of a Google Bar Chart

by Spencer Smith

HTML

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  <div id="chart_div"></div>

JavaScript

google.charts.load('current', {packages: ['corechart', 'line']});
google.charts.setOnLoadCallback(drawBasic);

function drawBasic() {

  var data = google.visualization.arrayToDataTable([
    ['Month', 'Reviews'],
    ['May \'19',  2],
    ['Jun \'19',  5],
    ['Jul \'19',  6],
    ['Aug \'19',  12],
    ['Sep \'19',  16],
    ['Oct \'19',  20],
    ['Nov \'19',  22],
    ['Dec \'19',  24],
    ['Jan \'20',  26],
    ['Feb \'20',  35]
  ]);

  var options = {
    curveType: 'function',
    hAxis: {
      title: 'Month'
    },
    vAxis: {
      title: 'Reivews'
    },
    trendlines: {
      0: {type: 'linear', color: '#111', opacity: .3}
    }
  };

  var chart = new google.visualization.LineChart(document.getElementById('chart_div'));

  chart.draw(data, options);
}