Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using this link to achieve zoom in functionality on canvas
http://bl.ocks.org/mbostock/raw/3680958/[^]

From below code i want to replace append("canvas") with the canvas which already exists on page may be by using document.getElementById('canvas1'). After replacing it the node() returns null. What could be the reason?
JavaScript
var canvas = d3.select("body").append("canvas")
  .attr("width", width)
  .attr("height", height)
  .call(d3.behavior.zoom().scaleExtent([1, 8]).on("zoom", zoom))
  .node().getContext("2d");
Posted
Comments
RedDk 20-Sep-14 14:04pm    
this metaplasm "http://bl.ocks.org/mbostock/raw/3680958/" is zerblickt ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900