Struggling with modified fustion table/google bar charts example

20 views
Skip to first unread message

jordando...@gmail.com

unread,
Jan 29, 2016, 6:25:25 PM1/29/16
to Google Visualization API

I need to graph the number of vehicles, number of casualties and number of total rows in a fusion table with the names of each bit of information connected to the column. ie:
Casualties |xxxxxxxxxxxxxxxxxxxxxx  Vehicles    |xxxxxxxxxxxxxxxx        Total Accidents |xxxxxxxxxx                                     amount        


At the moment, what I've managed to get is: http://i.imgur.com/LsNEodX.png


I've modified an example on Googles' guides that displays data from a fusion table in a chart, I've had to put Number_of_Vehicles in twice in order to have it set the V axis. I am almost there visually but certain I'm very far off with the code and after looking through the documentation I haven't found any guides on how to have manually inserted rows of data for the chart as well as data from the fusion table.

My code:

<script type="text/javascript">
            google.load('visualization', '1', { packages: ['corechart'] });

            function drawVisualization() {
                google.visualization.drawChart({
                    containerId: 'visualization',
                    dataSourceUrl: 'http://www.google.com/fusiontables/gvizdata?tq=',
                    query: 'SELECT SUM(Number_of_Vehicles), SUM(Number_of_Vehicles), SUM(Number_of_Casualties), COUNT()  FROM 1wgVs5uXfTIDjccR4CfKI_CUct8YxVjs-NMQx9sp0',
                    chartType: 'BarChart',
                    options: {
                        title: 'Number of casualties to vehicles',
                        vAxis: {
                            title: 'Casualties'
                        },
                        hAxis: {
                            title: 'Amount'
                        }
                    }
                });
            }

            google.setOnLoadCallback(drawVisualization);
        </script>
Reply all
Reply to author
Forward
0 new messages