I think there's a bit of confusion here. What exactly do you mean by 'serializing' the chart ?
If you intend to persist the chart state in same format that can be later rebuilt, this is already available, for example using ChartWrapper.toJSON()<http://code.google.com/apis/chart/interactive/docs/reference.html#chartwrapperobject> . See the sources of this example<http://savedbythegoog.appspot.com/?id=52de9ea50453e4aeb4a5af5f1f8f85c0ea3a9bcf> which draws a chart, serializes it into a json string and then parses it back again to build a clone. If you intend converting the chart to image, then indeed that is something that is currently explicitly supported only inside Google Apps Script<http://code.google.com/googleapps/appsscript/service_charts.html> via the getBlob()<http://code.google.com/googleapps/appsscript/class_chart.html#getBlob>method you mentioned. Alternatives way, such as converting the chart svg into <canvas /> and building an image out of that, could probably work, but they are outside the library boundary (read: you have to implement them on your own). -- R. On 31 October 2011 13:16, Roni Biran <[email protected]> wrote: > according to the I/O 2011 (London GTUG) this feature is supposed to be > supported in the future for ChartWrapper ( > http://www.battlehorse.net/wontlast/gtugChartsLondon/index.html#27), > however I don't think it's supported at the moment. > > I know for myself, that I need this feature for exporting charts as images. > If you'll find a way to make it work, please let us all know. > > > > On Mon, Oct 31, 2011 at 1:10 PM, Eric <[email protected]> wrote: > >> I am using the html examples at >> http://code.google.com/apis/ajax/playground/#line_chart >> >> This html I paste into a server page. >> >> How do I load the appropriate libraries and call the methods in order to >> serialize the chart produced? Please could someone refer me to a >> *working example* >> of html/javascript for this. >> >> I am able to implement this with the examples given for serialization and >> email but then only as a function in a script editor. >> I believe this has to do with my lack of understanding of the javascript >> and the loading of libraries with google.load. >> When I try to include the following code in an html page in the , I get >> "unexpected Identifier" >> or "unknown method getBlob". >> >> First I change the line >> new google.visualization.LineChart( ... >> to >> var myChart = new google.visualization.LineChart(... >> >> Then in the main function of the linechart example, add the stanzas; >> >> var chartBlob = myChart.getBlob().getBytes(); >> >> var chartFile = [{fileName: "chart.png", >> mimeType: "image/png", >> content: chartBlob}]; >> >> I would appreciate advice on how to implement this correctly. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Visualization API" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/google-visualization-api/-/-HUmK2on2vwJ. >> To post to this group, send email to >> [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-visualization-api?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-visualization-api?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
