Skip to content

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

Open
@nmdefries

Description

@nmdefries

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions