There's some indication that plotly plots are faster to generate than making a ggplot2 plot and converting to plotly. Since plot creation and rendering is a slow part of the dashboard, meaning this switch could be a good way to provide overall speedups to the dashboard.
Add gray rectangle between faceted plots to display horizon info. Formatting info for rectangles and horizon labels:
# Horizon rectangles
str(finalPlot$x$layout$shapes, max.level = 2)
List of 4
$ :List of 9
..$ type : chr "rect"
..$ fillcolor: chr "transparent"
$ line :List of 3
..$ color : chr "rgba(51,51,51,1)"
..$ width : num 0.664
..$ linetype: chr "solid"
..$ yref : chr "paper"
..$ xref : chr "paper"
..$ x0 : num 0
..$ x1 : num 1
..$ y0 : num 0.514
..$ y1 : num 1
$ :List of 11
..$ type : chr "rect"
..$ fillcolor: chr "rgba(217,217,217,1)"
..$ line :List of 3
..$ yref : chr "paper"
..$ xref : chr "paper"
..$ x0 : num 0
..$ x1 : num 1
..$ y0 : num 0
..$ y1 : num 23.4
..$ yanchor : num 1
..$ ysizemode: chr "pixel"
Horizon labels
str(finalPlot$x$layout$annotations, max.level = 2)
$ :List of 12
..$ text : chr "Horizon: 2 Week(s)"
..$ x : num 0.5
..$ y : num 0.486
..$ showarrow: logi FALSE
..$ ax : num 0
..$ ay : num 0
..$ font :List of 3
..$ xref : chr "paper"
..$ yref : chr "paper"
..$ textangle: num 0
..$ xanchor : chr "center"
..$ yanchor : chr "bottom"
- Add "drag to zoom" text as separate annotation? might scale better with page size changes
- [Add horizontal reference line](https://github.com/cmu-delphi/forecast-eval/blob/d0cec65fdc1d5654496d8b10982e51300ae79cb0/app/server.R#L459) for coverage plots
- Setting x-axis limits depending on the as-of date selection and whether forecast values are displayed on the truth plot. `plotly` doesn't [let an axis limit float if passed an `NA`](https://github.com/cmu-delphi/forecast-eval/blob/381814483b6aa6a7e7f0b1bc97766d83561c65b7/app/server.R#L433-L439), so we'd probably need to define a separate function to calculate min/max x limits based on data range.
- Make y-axis ranges match across subplots
There's some indication that
plotly
plots are faster to generate than making aggplot2
plot and converting toplotly
. Since plot creation and rendering is a slow part of the dashboard, meaning this switch could be a good way to provide overall speedups to the dashboard.Most of the work has already been done on the
ndefries/use-plotly-directly
branch. Remaining tasks to match behavior of current dashboard:Horizon labels