Question on Group by year and Quarter

9 views
Skip to first unread message

lmossolle

unread,
Apr 27, 2017, 10:51:04 AM4/27/17
to Google Visualization API
I have 4 columns of Data. I would like to have the ability to group by year and quarter can someone assist with this? Here is the HTML that I am using. Thanks in advance!


<html>
  <head>
    <!--Load the AJAX API-->
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawChart);

      // Callback that creates and populates a data table,
      // instantiates the pie chart, passes in the data and
      // draws it.
      function drawChart() {

      // Create the data table.
      var data = new google.visualization.DataTable();
      data.addColumn('string', 'FY');
      data.addColumn('number', 'QTR');
      data.addColumn('number', 'AWD Actions');
      data.addColumn('number', 'MOD Actions');
      data.addRows([
        ['2015', 1, 226, 1429],
        ['2015', 2, 325, 1165],
        ['2015', 3, 378, 1173],
        ['2015', 4, 1371, 1799],
        ['2016', 1, 144, 1111],
        ['2016', 2, 276, 1109],
        ['2016', 3, 393, 1066],
        ['2016', 4, 1349, 1636],       
        ['2017', 1, 129, 972],
        ['2017', 2, 273, 1117],
        ['2017', 3, 78, 298]
      ]);

      // Set chart options
      var options = {'title':'How Much Pizza I Ate Last Night',
                     'width':400,
                     'height':300};

      // Instantiate and draw our chart, passing in some options.
      var chart = new google.charts.Bar(document.getElementById('chart_div'));
      chart.draw(data, options);
    }
    </script>
  </head>

  <body>
<!--Div that will hold the pie chart-->
    <div id="chart_div" style="width:400; height:300"></div>
  </body>
</html>
Reply all
Reply to author
Forward
0 new messages