google chart图表数据来源于数据库

我想做一个图表,图表数据部分来源于数据库,请问怎么做的

google chart demo:

  var data = google.visualization.arrayToDataTable([
             ['Month', 'Bolivia', 'Ecuador', 'Madagascar', 'Papua New Guinea', 'Rwanda', 'Average'],
             ['2004/05', 165, 938, 522, 998, 450, 614.6],
             ['2005/06', 135, 1120, 599, 1268, 288, 682],
             ['2006/07', 157, 1167, 587, 807, 397, 623],
             ['2007/08', 139, 1110, 615, 968, 215, 609.4],
             ['2008/09', 136, 691, 629, 1026, 366, 569.6]
            ]);

            var options = {
                title: 'Monthly Coffee Production by Country',
                vAxis: { title: 'Cups' },
                hAxis: { title: 'Month' },
                seriesType: 'bars',
                series: { 5: { type: 'line' } }
            };

            var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
            chart.draw(data, options);

类似这样的数据你可以从后台查出来 然后转成json格式再在前台调用