airbnb / visx

🐯 visx | visualization components
https://airbnb.io/visx
MIT License
19.43k stars 710 forks source link

[question] interacting with data from a stream #123

Closed matthax closed 7 years ago

matthax commented 7 years ago

I understand this project is a relatively new undertaking, but I was curious about some future features, and the end goal of vx, specifically around the idea of processing and graphing live data.

D3 exposes a number of mechanisms that make it, relatively, easy to handle data from a stream. Obviously here these mechanisms are somewhat hidden, due to the nature of these components. Is there a plan to support plotting/charting/graphing data from a stream?

Currently, the only way I see this being possible is to store a data object, and as new data points are added, append them to the data object and pass that data back into the component. The issue I'm seeing is that given a relatively fast stream (say 1 new data point every 100ms) performance begins to drop.

A better solution might be to provide the chart some mechanism to receive data from a stream (callback to process the incoming request or similar) and then render the data point and shift it onto the visible chart/graph area. The visible data would need some sort of limiting factor, be it max data points or a sort of decay based on a time series. I see a number of viable use cases related to server performance dashboards, geo-location & heatmap plotting, or live active user counts that could benefit from a feature like this tremendously.

Is this something you've considered or something that might be coming in the future? Are there currently mechanisms in place that might allow me to create my own stream-based component?

hshoff commented 7 years ago

Hi @matthax thanks for checking out vx. vx will remain unopinionated about this for now. Since vx is just react there are many different approaches, assumptions, and trade-offs. Should able to wrap vx components in your own and turn them into stream-based components. Would love to see additional libraries made that would make this easier for folks.