I'm building a python web app to work with google's earth engine API,

I display data through javascript using chart API and want to allow users 
to download the data as CSV. I am confused however when reading online 
there are multiple ways to load the chart / visualization api's and I can't 
seem to find out what I am doing wrong to be able to have access to the 
dataTableToCsv() function.

I found this code somewhere online and checked the docs to see that this is 
actually a valid function:

$('#download-csv').click(function () {
    var csvFormattedDataTable = 
    var encodedUri = 'data:application/csv;charset=utf-8,' + 
    this.href = encodedUri;
    this.download = 'table-data.csv';
    this.target = '_blank';

I'm loading the charts api as follows:

google.load('maps', '3', {'other_params': 'key=' + key + '&libraries=drawing'});

google.setOnLoadCallback(function () {
    google.charts.load('current', {packages: ['corechart']});
    google.charts.setOnLoadCallback(function () {
        precipitation.instance = new precipitation.App();

Now if someone could give some additional advice on how to correctly load 
the api nowadays that'd be great :)

When I click the button I get the following error:


Line 60 being: 

var csvFormattedDataTable = google.visualization.dataTableToCsv(this.chartData);

In my index.html I have both loaders:

<script type="text/javascript" src="https://www.google.com/jsapi";></script>
<script type="text/javascript" 

You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to