Save Google charts as a image

前端 未结 4 576
刺人心
刺人心 2020-12-05 05:55

So after hours of websearching, googling and overflowing i can\'t find the solution to my problem.

I got a linechart from Google charts. I want to convert it to PNG,

4条回答
  •  孤街浪徒
    2020-12-05 06:44

    I have the same issue - Save Google charts as image on server. None of answers here works for me. Finally I get solution but with some bugs(working only in Chrome browser). As base I used script from here https://gist.github.com/mpetherb/7085315 I made some changes for my project. I use jquery for importing generated graph image to to my server. This is a graph that I want to convert to image and save google graph example id="ex0"

    Script for converting to image and importing to server

    
    
    
    // ex0 - div id of this type of google graph. If you using another type of google graph - you should change it
    Don't forget include jquery to your code.

    and php hidden script for receiving data from jquery method POST and saving it on server

    hidden.php file

    I will notice again - works only in Chrome browser. Firefox also create image file on server but without any content (looks like firefox not support base64 encoded data)

提交回复
热议问题