Search code examples
javascriptjquerycanvasjqplot

Jqplot generating png with transparent background


I have a linechart with transparent background. Underneath there is a div with gradient colors, because i don't think that is possible with jQplot.

But when i want to print the chart, the canvas is not printet. So i use jQplots function to convert the canvas to png. But the png has white background.

Do anyone know if its possible to convert the plot to png with transparent background (maby some 3rd party plugin haven't found one that do the job) or make the plot print with the canvas?


Solution

  • I finally found the solution. The jqplotToImageStr({}); has options possibilities. So i could generate the png with transparent background like this:

    var options = {
    backgroundColor: 'transparent'
    };
    var imgData = $('#plot').jqplotToImageStr(options);