title: using google charts with Flask
body: <p>I'm trying to make a simple line chart with google charts (first time) in my simple  Flask web app. I can't get the chart to show up. Here is my code in my template file:</p>
  
  
  
  <pre><code>&lt;script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        google.charts.load('current', {'packages':['corechart']});
        google.charts.setOnLoadCallback(drawChart);
          function drawChart() {
  
                        var data = google.visualization.DataTable();
                            data.addColumn('date','date-time');
                            data.addColumn('number', 'chiller_load');
                            data.addRows({{ data | safe }});
  
                        var options = {
                          title: 'Exchange rate overview',
                          chartArea: {width: '50%'},
                          legend: { position: 'bottom' }
                        };
  
                        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
  
                        chart.draw(data, options);
           }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>now i'm pretty sure the data is being sent to the template as a list-of-lists b/c i can see the list by just putting {{data | safe}} in my template. I also confirmed by running the backend function in jupiter and getting the expected list of lists.
  If it helps, here's the function that's fetching and sending the data:</p>
  
  <pre><code>def fetch_column(col_name):
      db = get_db()
      column = []
      q_result = db.query('select time_stamp, '+col_name+' from op_data;')
      for measurement in q_result:
          column.append([ measurement['time_stamp'] , measurement[col_name] ])
      return column
  </code></pre>