How to convert highchart to binary image

前端 未结 2 1572
眼角桃花
眼角桃花 2021-01-27 06:40

I\'am using highchart for plotting a graph with angular:

HTML:


         


        
相关标签:
2条回答
  • 2021-01-27 07:17

    Thanks, at last I got the answer:

    HTML:

    <img id="mock" />
    

    JS:

    var svg = document.getElementById('chart').children[0].innerHTML;
    //svg = chart.getSVG(); 
    
    var base_image = new Image();
    svg = "data:image/svg+xml," + svg;
    base_image.src = svg;
    $('#mock').attr('src', svg);
    

    We can save image tag directly in DB also. Ref. Save highchart to binary image.

    0 讨论(0)
  • 2021-01-27 07:18
     var canvas = document.createElement("chart");
    

    Replace to:

    var canvas = document.getElementById("chart");
    
    0 讨论(0)
提交回复
热议问题