skokenes / d3-lasso

A lasso plugin for d3
BSD 3-Clause "New" or "Revised" License
88 stars 35 forks source link

Added synthetic mode #13

Closed gioele-antoci closed 4 years ago

gioele-antoci commented 4 years ago

DEMO here: https://stackblitz.com/edit/lasso-synthetic?file=index.js

The vanilla lasso library has an expectation on nodes being present in the DOM. This PR provides a way to switch mode to synthetic, where no DOM nodes are needed to enabling lasso. This is particularly needed when rendering an abstraction of a scatter plot that might contains tens of thousands of events (e.g. density map). Having to render so many DOM nodes just to enabling lasso has a significant performance impact.

This will allow the user to create an object structure that will mirror the lasso-able nodes without needing to render them.

gioele-antoci commented 4 years ago

After more debugging, I realized this only works for elements that are not translated. More development is necessary