Reputation: 715
Is there anything in Dash world that gives a nice interface for inputting datetimes/timedeltas (doesnt matter what type, np, pd, dt etc)? I can only find code that really supports dates currently https://dash.plotly.com/dash-core-components/datepickersingle. I am trying to create a plotting tool for real time sensor data, at the moment it runs in "streaming mode" with a set lookback, this just updates an animated graph every 2 seconds and "rolls" across the screen. I would also like to have a historical look and be able to set the start and end datetimes on the call to the database.
Upvotes: 3
Views: 5690
Reputation: 715
Minimal example using html input type
from dash import Dash, dcc
app = Dash(__name__)
app.layout = dcc.Input(type="datetime-local", step="1")
if __name__ == '__main__':
app.run_server()
here step="1"
gives seconds, the standard view seems to only give minutes (step="60"
would give minutes, step="3600"
hours, step="0.001"
millis etc)
NB: This is not supported officially by dash https://dash.plotly.com/dash-core-components/input
ALLOWED_TYPES = (
"text", "number", "password", "email", "search",
"tel", "url", "range", "hidden",
)
which means to run in debug mode you would need to turn off dev_tools_props_check
app.run_server(debug=True, dev_tools_props_check=False)
The main problem seems to be browser support https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local#handling_browser_support
Upvotes: 4