download chart as JPEG or PDF


#1

Hi,

How can I download charts as JPEG/PNG/GIF any image format or PDF format?


Exporting dhtmlxChart
#2

Unfortunately it is not possible in the current version.


#3

Please guide how it could be implemented -> please suggest some libraries to do it
we need to support that functionality

also put that charts (coverted to graphic formats) in reports.

we have finished implementation all the functionality of the module
but the download and reports modules are held up as we cant get charts in graphics format.

Your help will be highly appreciated.
Thank you,


#4

Do you need to support such functionality in IE8, IE7 ?
If ignore that browsers - other ones allows to export canvas as image, which can be used for partial chart exporting.


#5

Functionalities of our web application is supported in

IE9 + all major browser

however some functionalities does not work in IE7 and IE8.

So please point me to code (provide a sample) which can do the export of charts to PNG and JPG.

Thank you so much for your support.
–Pradeep


#6

You may use the getCanvas() of a chart to get canvas and then call toDataURL:

var canvas = yourChart.getCanvas();
var img = canvas.toDataURL(“image/png”);


#7

var canvas = yourChart.getCanvas();
I was succesful with the above

but firebug complains that such toDataURL does not exists.
var img = canvas.toDataURL(“image/png”);

please help.


#8

Sorry, please call the following

var canvas = yourChart.getCanvas().canvas;

instead of

var canvas = yourChart.getCanvas();


#9

Hello,

I was going through this post for exporting my dhtmlx chart to excel.
my code snippet:
that.mychart = graphattachLayout.cells(“b”).attachChart({
view : “bar”,
value : “#Distance#”,
/////// (rest of chart properties, chart is displayed properly on my layout)
});

on this chart element I am calling:
that.mychart.getCanvas().canvas;

I am getting exception:
that.mychart.getCanvas is not a function

Please help at the earliest


#10

the original post and the solution is from the 2011.
Unfortunately currently there is no export to canvas feature in the dhtmlxChart.


#11

Thanks for the reply, I used html2Canvas to solve this problem…
But have an issue with css rotated text… :frowning:


#12

Could you please, clarify your issue.