metric_panel: Display a metric in a panel

Description Usage Arguments Examples

View source: R/metric-panel.R

Description

Display a metric in a panel

Usage

1
2
3
4
5
6
7
metric_panel(input, output, session, metric, plot_type = NULL,
  plot_fun = NULL, plot_post_process = NULL,
  orientation = "vertical", selected_date_range_preset = "All Time",
  selected_period = "Week", height = 400, div_bottom_left = NULL,
  hidden_dimensions = NULL, ...)

metric_panel_ui(id, ...)

Arguments

input

standard shiny boilerplate

output

standard shiny boilerplate

session

standard shiny boilerplate

metric

A metric to display. It should be a list with data and title

plot_type

Either "line" or "bar": if neither is given, it guesses "line" for pct, avg, min, median, and max metrics, and "bar" otherwise. Ignored if plot_fun is provided.

plot_fun

A plotting function that takes two arguments - data and dimension

plot_post_process

a function to post-process the default plot

orientation

a string indicating orientation (vertical or horizontal)

selected_date_range_preset

Default date range preset to use. Use date_range_presets_vec() to look up possible presets

selected_period

Default period to display the data

height

height of the panel

div_bottom_left

html to display on bottom left of the panel

hidden_dimensions

A vector of dimension names that should not be displayed as tabs.

...

Additional parameters passed to the server

id

a string indicating the id to call the module with

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(dplyr)
## Not run: 
 metrics_condensed <- datacampr::dc_s3_read(
   "metrics_condensed.rds"
 )$metrics_condensed
 preview_metric(
   metric = metrics_condensed$finance_forecasts_usd_arr_total,
   plot_type = 'line'
 )
 preview_metric(metrics_condensed$finance_cash_usd_cash_in)

## End(Not run)

ramnathv/shinymetrics documentation built on June 29, 2020, 10:39 p.m.