Home forums Using CanvasJS Is there a way to increase dpi for higher resolution printing?

This topic contains 1 reply, has 2 voices, and was last updated by  Vishwas R 5 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #10363


    Hi! I’m trying to create printable version of a page with a small graph in the bottom third of the page. It looks fine on screen, and prints correctly, but the resolution of the graph is (unsurprisingly) really low. It’s even more noticeable since the rest of page prints quite nicely being just text.

    I tried increasing the dpi by following this stackoverflow post, by using the following:

    var canvas = document.getElementsByClassName("canvasjs-chart-canvas");
    var i;
    for (i = 0; i < canvas.length; i++) {
      var dpifactor = 300/96;
      var w = canvas[i].width;
      var h = canvas[i].height;
      canvas[i].width = w*dpifactor;
      canvas[i].height = h*dpifactor;
      canvas[i].style.width = w + 'px';
      canvas[i].style.height = h + 'px';

    Sadly, while it seems to do something, it doesn’t actually do what I want. Is there a built in function for increasing DPI, or any workarounds?

    Worst case I was thinking about generating a graph in gigantic-size, exporting it as a png, then including it, theoretically all in js, but that seems like a really inelegant solution.


    Vishwas R


    Sorry for the inconvenience. We are looking into the issue and will get back to you.

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

You must be logged in to reply to this topic.