d3-lasso icon indicating copy to clipboard operation
d3-lasso copied to clipboard

In order to use lasso, one has to import whole "d3" module, do we have any better way?

Open rahul-winner opened this issue 6 years ago • 0 comments

I'm using this package in one of my Angular application. Presently, I need to import "d3" package and set it to window variable to make lasso work. A snippet of code is as follows

import * as d3 from "d3"; ... ... @Component() export class mycomp { constructor() { window["d3"] = d3; }

ngOnInit() { initLasso(); }

initLasso() { const targetAreaToSelectNodes = lasso() .closePathSelect(true) .closePathDistance(100) .items(nodes) .targetArea(svg); targetAreaToSelectNodes.on("start", () => { }); targetAreaToSelectNodes.on("draw", () => { }); targetAreaToSelectNodes.on("end", this.onNodesSelectionEnd.bind(this, targetAreaToSelectNodes, d3)); svg.call(targetAreaToSelectNodes); }

}

Does anyone here think this can be done a little differently?

rahul-winner avatar Oct 11 '18 09:10 rahul-winner