mini-kep / frontend-dash

Dash application with interactive controls and time series plotting.
1 stars 0 forks source link

URLs to access specific plot in browser #13

Open epogrebnyak opened 6 years ago

epogrebnyak commented 6 years ago

I have an app in plotly/Dash, that draws some charts. Dash produces JavaScript code, which is rendered by browser. In is working fairly nicely, but has one limitation: once it is browser-side Javascript code, there is just one address for the whole application.

App: http://macrodash.herokuapp.com Code: https://github.com/mini-kep/frontend-dash/blob/master/app.py

My desired behaviour is the following: I want to have URLs that link to to specific charts, eg:

It is a bit tricky to do that with Dash and Flask.

In Dash there are callbacks to update/reload browser address:

https://plot.ly/dash/urls

This functionality is ok for changing the addresses once you are at http://macrodash.herokuapp.com and further navigate by selecting variable names and frequencies.

What I'm lacking now is the landing page functionality: how can I type and addrress like http://macrodash.herokuapp.com/q/GDP_yoy+CPI_rog in the browser and further find myself on a page with these indicators plotted?

This functionality involves wrapping Dash with Flask, and I could not find an easy way to do that. Th possible routes are outlined here: https://github.com/plotly/dash/issues/38#issuecomment-311757374