Using Plot.bin and other transforms outside a graph context?

Hey, been diving into Observable and generally love it. I’ve been trying to figure out how to pull data from a graph and use it in other contexts, such as an html block that explains or does additional computation on a value.

Specifically, I’d like to take a transform like Plot.binX and figure out the underlying bins it generates, so I can write a statement like “The average for ${bins[0]} is ${average(bins[0])}

I’ve been doing this previously by embedding values I need into the svg with ariaLabel and then querying the DOM, but I’m sure there’s a better way.

Hi, I think this might answer your question:

1 Like

It sure does, thank you!

2 Likes