Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider making plotly plot directly instead of converting from ggplot plot #276

Open
nmdefries opened this issue Apr 26, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@nmdefries
Copy link
Collaborator

nmdefries commented Apr 26, 2023

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.

Most of the work has already been done on the ndefries/use-plotly-directly branch. Remaining tasks to match behavior of current 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 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, 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
@nmdefries nmdefries added the enhancement New feature or request label Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant