Home › forums › Using CanvasJS › Exporting chart with padding around canvas
Tagged: borders, export, padding
This topic contains 3 replies, has 2 voices, and was last updated by Indranil Deo 7 months, 3 weeks ago.
I need to set up padding (or borders) around whole canvas chart. I have tried to use css and it worked well in browsers but in exports it did not.
I use this for export:
canvas = $('#container .canvasjs-chart-canvas').get(0);
img = canvas.toDataURL("image/jpeg");
You can add a padding/border to the DIV(container) then capture the image of the DIV(container) using html2canvas library and export the image. Please take a look at this jsfiddle.
Thanks Indranil, I know about html2canvas but for me it’s an ugly solution to use another plugin just for adding padding around container. In my opinion cavnasJS is a nice and complex plugin, just this one think…
I definitely suggest adding this standard functionality to the next upgrade!
Thanks for the suggestion.
You must be logged in to reply to this topic.