leeoniya / uPlot

📈 A small, fast chart for time series, lines, areas, ohlc & bars
MIT License
8.51k stars 371 forks source link

Plot outliers in box & whisker graph #852

Closed hugovoerman closed 10 months ago

hugovoerman commented 10 months ago

Question:

Did anyone added plotting the outliers to the Box & Whisker plot based on the demo Box & whisker plugin + legend-as-tooltip plugin?

I would like to have the outliers shown as demoed on Wikipedia Box plot figure 3

hugovoerman commented 10 months ago

You are amazing! Thank you for this guidance. I will take it from here for my application.

leeoniya commented 10 months ago

added outlier rendering to the demo in https://github.com/leeoniya/uPlot/commit/f2804d0787f493f472be1d4f718ac8940c093c04. they're drawn on canvas, so you cannot interact with them without implementing a quadtree or some other spatial index, as is done in the bubble demo [1].

if you want them to be interactive, you could alternatively implement this rendering in the DOM (by adding elements to the u.over container), and get mouse events/interaction without a spatial index but at the cost of possibly hundreds or thousands of DOM nodes re-created on every zoom/re-render.

[1] https://leeoniya.github.io/uPlot/demos/scatter.html

hugovoerman commented 10 months ago

Perhaps you can give me a pointer in how to add the outliers to the tooltip. Much appreciated!