I am looking for an easy way to export a Chart generated with views, in a format that can be easily printed: PDF or JPEG or similar.

Is there a way to do it?

Comments

t.eshqair’s picture

Iam looking for a similar tool

IKE0088’s picture

+1

zied.ellouze’s picture

Issue summary: View changes

Hi
is that you have found a solution
thank you

Pierre.Vriens’s picture

Refer to the features section of my Comparison of charting modules for charting modules that currently support export to PDF.

arunkumark’s picture

Issue tags: +Pie charts, +google charts, +save, +PDF

The Google charts are generated at the client side, so we can't save chart as PDF. For the case of exporting need to save as image using client side scripting.

1. Include the Below JS files.

2. Add the canvas tag in your page (<canvas id="canvas"></canvas>)

2. Create a button to generate Image with id of BUTTON_ID

3. Put the below code in our custom JS file

jQuery(document).ready(function(){
  jQuery("#BUTTON_ID").on("click", function(){
    var svg = '<svg width="1134" height="567" style="overflow: hidden;" aria-label="A chart.">' + jQuery("svg").html() + '</svg>';
    canvg(document.getElementById('canvas'), svg);
    var canvas = document.getElementById("canvas");
    var data = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
    window.location.href = data;
    jQuery("#canvas").hide();//Comment this line if want to show the image in browser
  });
});

4. Run the code