score:3

Accepted answer

you just need to modify the existing code mentioned in the fiddle with following code. this might help you work with v2.

animation: {
    oncomplete: function(data) {
        var getparentidname = this.chart.canvas.attributes.id.value,
        targetelement = document.getelementbyid("virtual-chart-axis"),
        sourceelement = document.getelementbyid("organizational-view"),
        sourcecanvas = this.chart.ctx.canvas,
        copywidth = this.scales["y-axis-0"].width, // we are copying the width of actual chart
        copyheight = this.chart.height, // we are copying the width of actual chart
        targetelementwidth = sourceelement.getcontext("2d").canvas.clientwidth,
        targetelementheight = sourceelement.getcontext("2d").canvas.clientheight,
        targetctx = targetelement.getcontext("2d");

        targetctx.canvas.width = copywidth;
        targetctx.canvas.height = copyheight;
        targetctx.drawimage(sourcecanvas, 0, 0, targetelementwidth, targetelementheight);
    }
}

good luck.


Related Query

More Query from same tag