How make load external data

42 views
Skip to first unread message

Alan C.

unread,
Dec 14, 2011, 7:42:12 AM12/14/11
to Google Visualization API
Hi,

I'm developping an aplication which need a large data table...
I wonder if exist a method for load this table from the disk...

[]'s

Roni Biran

unread,
Dec 14, 2011, 10:34:22 AM12/14/11
to google-visua...@googlegroups.com
what do you mean by "load from disk"? do you mean to upload to the google servers?
you are the one who creates the page. you can upload the file into a google spreadsheet and query that spreadsheet for charts generation.





--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


Alan C.

unread,
Dec 15, 2011, 12:06:12 PM12/15/11
to Google Visualization API
Yes, I meant it... from server!

But, how do I put these data on the server? The data in this format:

['number', 'number'],

example: [1, 23.44],
[2, 16.71],
...
[1000, 12.09]


On 14 dez, 13:34, Roni Biran <roni.bi...@gmail.com> wrote:
> what do you mean by "load from disk"? do you mean to upload to the google
> servers?
> you are the one who creates the page. you can upload the file into a google
> spreadsheet and query that spreadsheet for charts generation.
>

> here is an excellent sample:http://code.google.com/apis/ajax/playground/?type=visualization#using...

asgallant

unread,
Dec 15, 2011, 1:44:11 PM12/15/11
to google-visua...@googlegroups.com
You can either pre-populate your chart's data using server-side scripting to fill the data into the javascript, or you can set up the charts to pull data dynamically, and create a separate script that outputs the data in a JSON structure.  How you do the first depends on the scripting language you use, here's a simple example using PHP:

<?php
    // $data is an array of chart data
    // $column is an array of column data
    // $options is a JSON-encoded string of chart options

?>
function drawChart ({
    var data new google.visualization.DataTable();
    data.addColumn('<?php echo $column[0]['type']; ?>''<?php echo $column[0]['label']; ?>');
    data.addColumn('<?php echo $column[1]['type']; ?>''<?php echo $column[1]['label']; ?>');
<?php
    foreach ($data as $row{
        echo "data.addRow(['{$row[0]}', {$row[1]});";
    }
?>
    
    var chart new google.visualization.BarChart('chart_div');
    chart.draw(data<?php echo $options; ?>);
}
Reply all
Reply to author
Forward
0 new messages