Hi,I cannot export google visualization charts to csv/pdf. Please help. I have already drawn the chart and all, but cannot export the charts. I am using client side coding using Java Script. Regards,Soumyajit
As per Google, this capacity is not yet provided. However if there is any indirect way, then I would love to know that. Also if it is possible to export the contents of a div with a Google charts wrapper container, then how to do that? Please do not re-send me my questions. Please help me with solutions.
You can try this code to create chart, table and toolbar. google.load("visualization", "1", { packages: ["corechart"] }); google.load('visualization', '1', { packages: ['table'] }); //google.setOnLoadCallback(drawChart); function drawChart() { $.ajax({ type: "GET", url: '@Url.Action("GunlukOkumalar", "Enerji")', data: "startDate=" + $('#start_date').val() + "&endDate=" + $('#end_date').val() + "&sayac_id=" + $("#sayaclar").val(), //belirli aralıklardaki veriyi cekmek için success: function (result) { if (result.success) { var evalledData = eval("(" + result.chartData + ")"); var opts = { curveType: "function", width: '100%', height: 500, pointSize: 5 }; new google.visualization.LineChart($("#chart_div").get(0)).draw(new google.visualization.DataTable(evalledData, 0.5), opts); $('#chart_div').show(); var visualization; var data; var options = { 'showRowNumber': true }; data = new google.visualization.DataTable(evalledData, 0.5); // Set paging configuration options // Note: these options are changed by the UI controls in the example. options['page'] = 'enable'; options['pageSize'] = 10; options['pagingSymbols'] = { prev: 'prev', next: 'next' }; options['pagingButtonsConfiguration'] = 'auto'; // Create and draw the visualization. visualization = new google.visualization.Table(document.getElementById('table')); visualization.draw(data, options); var components = [ { type: 'html', datasource: data }, { type: 'csv', datasource: data } ]; var container = document.getElementById('toolbar_div'); google.visualization.drawToolbar(container, components); return false; } else { $('#chart_div').html('<span style="color:red;"><b>' + result.Error + '</b></span>'); $('#chart_div').show(); $('#table').html('<span style="color:red;"><b>' + result.Error + '</b></span>'); $('#table').show(); return false; } } }); } Hope it works.
Hi Anna, Thanks for your reply. I have already done what you have suggested. Actually I am aiming to export the chart that we can see on the page. After drawing the chart through the "chart.draw(data, options);" statement, I want to export the same chart. I had already composed the charts. All I want now is to export the chart to pdf/csv/excel. I can explore the data. I am sure of it. Even if I am using a container/wrapper for the chart component, I am unable to find a way to export the chart component. Please help. Regards, Soumyajit
Are you able to export the google chart into PDF Soumya, i'm having the same prob now. Please suggest