Skip to content

Instantly share code, notes, and snippets.

@xoor-io
Created April 10, 2018 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xoor-io/8e90961ded3abbaf65f5515729f3e115 to your computer and use it in GitHub Desktop.
Save xoor-io/8e90961ded3abbaf65f5515729f3e115 to your computer and use it in GitHub Desktop.
d3-canvas-zoom-01
function draw(transform) {
const scaleX = transform.rescaleX(x);
const scaleY = transform.rescaleY(y);
gxAxis.call(xAxis.scale(scaleX));
gyAxis.call(yAxis.scale(scaleY));
context.clearRect(0, 0, width, height);
dataExample.forEach( point => {
drawPoint(scaleX, scaleY, point, transform.k);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment