Home Forums Chart Support Exporting chart with padding around canvas

Exporting chart with padding around canvas

Viewing 4 posts - 1 through 4 (of 4 total)
  • #23812

    Hi all,

    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");
    

    Thanks!

    • This topic was modified 5 years, 4 months ago by bajlo.
    #23831

    @bajlo,

    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.

    ____________
    Indranil Deo,
    Team CanvasJS

    #23835

    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!

    #23845

    @bajlo,

    Thanks for the suggestion.

    ____________
    Indranil Deo,
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.