Javascript examples for Google Chart:Chart Configuration
Export google chart in a dashboard as png
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.0','packages':['corechart']},{'name':'visualization','version':'1.0','packages':['controls']}]}"></script> <div id="filter_div"></div> <div id="dashboard_div"> <div id="chart_div"></div> </div> <div id="png"></div> <script type="text/javascript"> google.setOnLoadCallback(drawDashboard); function drawDashboard() {/* w w w. ja v a 2s .c om*/ var data = google.visualization.arrayToDataTable([ ['Name', 'Donuts eaten'], ['Michael' , 5], ['Elisa', 7], ['Robert', 3], ['John', 2], ['Jessica', 6], ['Aaron', 1], ['Margareth', 8] ]); var dashboard = new google.visualization.Dashboard( document.getElementById('dashboard_div')); var select = new google.visualization.ControlWrapper({ 'controlType': 'CategoryFilter', 'containerId': 'filter_div', 'options': { 'filterColumnLabel': 'Donuts eaten' } }); var chart = new google.visualization.ChartWrapper({ 'chartType': 'ColumnChart', 'containerId': 'chart_div', 'options': { 'width': 500, 'height': 300, 'legend': 'right' } }); google.visualization.events.addListener(chart, 'ready', function() { console.log(chart.getChart().getImageURI()); document.getElementById('png').innerHTML = '<a href="' + chart.getChart().getImageURI() + '">Printable version</a>'; }); dashboard.bind(select, chart); dashboard.draw(data); } </script> </body> </html>