linnarsson-lab / loom-viewer

Tool for sharing, browsing and visualizing single-cell data stored in the Loom file format
BSD 2-Clause "Simplified" License
35 stars 6 forks source link

Tooltip placement algorithm #104

Open JobLeonard opened 7 years ago

JobLeonard commented 7 years ago

This looks promising, and it has a JS library too! "All" we need is a way to convert the points to a polygon: https://www.mapbox.com/blog/polygon-center/

JobLeonard commented 7 years ago

https://en.wikipedia.org/wiki/Alpha_shape

https://www.npmjs.com/package/alpha-shape

https://mikolalysenko.github.io/alpha-shape/index.html

Probably not scaling to hundreds of thousands of points, but still interesting

JobLeonard commented 7 years ago

https://github.com/AndriiHeonia/hull

JobLeonard commented 7 years ago

So I've been checking Delaunay libraries for JS (it's the typical kind of thing where you hope someone implemented a robust library for you), since it looks like we're going to need one.

I suspect this is the best option:

https://www.npmjs.com/package/delaunator

Four reasons: