Google Table chart printing in png

379 views
Skip to first unread message

Lucie W

unread,
Apr 29, 2016, 6:01:10 AM4/29/16
to Google Visualization API
Hello everybody,

I would like to print a Table chart in png.

This is my code.

function drawTable() {
       
var data = new google.visualization.DataTable();
        data
.addColumn('string', 'Semaines');
        data
.addColumn('number', 'Projets');
        data
.addColumn('number', 'Demandes');
        data
.addColumn('number', 'Tickets');
        data
.addRows([
         
['Mars S11', {v: 0, f: '0h'}, {v: 0, f: '0h'}, {v: 18.5, f: '18h30'}],
         
['Mars S12', {v: 12, f: '12h'}, {v: 0, f: '0h'}, {v: 15, f: '15h'}],
         
['Mars-Avril S13', {v: 4, f: '4h'}, {v: 2, f: '2h'}, {v: 19, f: '19h'}],
         
['Avril S14', {v: 6, f: '6h'}, {v: 3, f: '3h'}, {v: 10, f: '10h'}]
       
]);

       
var table_div = document.getElementById('table_div');
       
var table = new google.visualization.Table(table_div);
       
        google
.visualization.events.addListener(table, 'ready', function () {
            table_div
.innerHTML = '<img src="' + table.getImageURI() + '">';
            console
.log(table_div.innerHTML);
       
});
       
        table
.draw(data, {showRowNumber: true, width: '100%', height: '100%'});
     
}

When I open it, this error appear : "table.getImageURI is not a function".

So my question is: is it possible to print a Table chart in png ?

Thank you.

Daniel LaLiberte

unread,
Apr 29, 2016, 9:41:48 AM4/29/16
to Google Visualization API
The getImageURI() method is not supported for the Table chart, but it is all HTML anyway, so you should just be able to print it, if printing is your goal rather than getting an image.

--
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-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/cc0ca671-e779-4cf2-a8be-4647cfad83fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Lucie W

unread,
May 17, 2016, 3:52:15 AM5/17/16
to google-visua...@googlegroups.com
Thank you to your reply.
In fact, I would like to generate a PDF page who contain my all charts. That is why i would like to get my all chart in PNG.
But if you have another a solution to offer me, that suit me.

Thank you.

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/UqEab6hYd0w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.

To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
Reply all
Reply to author
Forward
0 new messages