export/convert chart from dojo charting to image

前端 未结 1 480
误落风尘
误落风尘 2021-01-06 17:44

can anyone tell me if it is possible to convert a dojo charting object into an îmage file? I need this as I want to export an Excel file from a webpage containing some data

相关标签:
1条回答
  • 2021-01-06 18:29

    What you found will work as long as you know what to do with SVG (e.g., rasterize it using Batik or other tools). The main example will work because any chart object has a surface property. So do something like that:

    dojox.gfx.utils.toSvg(chart.surface).then(
      function(svg){
        alert(svg);
      },
      function(error){
        alert("Error occurred: " + error);
      }
    );
    

    Another alternative is to switch dojox.gfx into Canvas mode, and grab the result as a raster image directly from Canvas. There is no helper for that in Dojo, but it is relatively easy to do.

    0 讨论(0)
提交回复
热议问题