jlab-sensing / DirtViz

DirtViz is a project to visualize data collected from sensors deployed in sensor networks.
https://dirtviz.jlab.ucsc.edu/
MIT License
4 stars 8 forks source link

add feature to query more data when panning chart out of range of queried data #171

Open aaron-wu1 opened 6 months ago

aaron-wu1 commented 6 months ago

Currently, the chart only displays data fetched from the db given the ranges specified by the datetime pickers in the header. If the user pans the chart outside of the given ranges, the charts will be blank since no new data was fetched.

With this new feature, when the user pans outside of the given range, it should smoothly fetch new data that fills in the empty gap in the graph if there's any new data.

image In the above screenshot, the chart's start date stops 1/29/24, but more there is more data in the db isn't queried yet. So with this new feature, the chart should also display the data before 1/29/24. This can be accomplished by utilizing the pan callback to query for new data, if needed.

Resources to look at: https://www.chartjs.org/chartjs-plugin-zoom/samples/fetch-data.html