flatironinstitute / stan-playground

Run Stan models in the browser
Apache License 2.0
36 stars 1 forks source link

Plot histograms only when visible (ReactVisibilitySensor) #204

Closed magland closed 3 months ago

magland commented 3 months ago

A possible solution to #201 that doesn't involve a "show more" button: only renders the plot if the element is visible. Uses package react-visibility-sensor.

One note, I had to hard-code a height=200px div in the case of not visible in order for this to work. I'm sure there's a better workaround.

WardBrian commented 3 months ago

This leads to some jittering during scrolling for me, as the top row of histograms will un-render and cause you to scroll back up briefly.

We're using the "show more" pattern in the draws table, I think it makes sense to do the same here.

magland commented 3 months ago

This leads to some jittering during scrolling for me, as the top row of histograms will un-render and cause you to scroll back up briefly.

We're using the "show more" pattern in the draws table, I think it makes sense to do the same here.

Okay I'll work on that

WardBrian commented 3 months ago

205