Google Charts as Image

前端 未结 5 2147
南旧
南旧 2021-02-13 19:36

I am trying to use Google charts to embed images of charts in the emails. So Each user will have a unique graph.

Can we use the API and embed a unique URL that will ren

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-13 20:23

    You can get a PNG version of your chart using chart.getImageURI() like following:

    Needs to be after the chart is drawn, so in the ready event!

    var my_div = document.getElementById('my_div');
    var my_chart = new google.visualization.ChartType(chart_div);
    
    google.visualization.events.addListener(my_chart, 'ready', function () {
      my_div.innerHTML = '';
    });
    
    my_chart.draw(data);
    

提交回复
热议问题