How to create image of div contains dc charts?

15 views
Skip to first unread message

Sadi

unread,
Dec 6, 2017, 9:08:41 AM12/6/17
to dc-js user group
I want to create image of div contains bar, line, pie.
I am using following example and want to take image of container class.


I am using html2canvas to implement it. following is the piece of code :

   $("#btnSave").click(function() { 
        html2canvas($(".container"), {
            useCORS: true,
//                        allowTaint:true,
            onrendered: function(canvas) {
                theCanvas = canvas;
                document.body.appendChild(canvas);

                // Convert and download as image 
                Canvas2Image.saveAsPNG(canvas); 
                
                $("#img-out").append(canvas);
                // Clean up 
                //document.body.removeChild(canvas);
            }
        });
    });

It's not working :(
Any idea how to implement it?

Any help is appreciated. I am really stuck this point. 
Reply all
Reply to author
Forward
0 new messages