Every time I search for info on this I seem to always find examples of D3.js reading minimal data from external files. I get that.
I would like to undersand how to feed my D3 chart relatively current data so it can be visualized in near real time. To be clear, my goal is to show multiple sensor data in a simple line chart over time. This would be very similar to a stock chart: y-axis = stock value and x-axis = date.
My questions are these:
Must the data always come from a static file? or
Can the chart be fed ‘live’ data straight from the sensor?
The problem I see with reading a static data file is that it would seem that this file is constantly changing with new data so the file would have to be constantly read to get the latest data. This does not make sense to me. Perhaps D3 has some algorithm to solve this.
All files are static - at the moment they are loaded.
The data set is still static in that if you never refresh it again, the data is what it was; but it’s dynamic in the sense that it has changed since you last checked the page/file/function.
Your chart doesnt care about whether the source it gets its data from changes between checks of the page - it simply loads whatever is there as its data source, at the given time. It is this style from which the enter, exit, and update functions in D3 operate.