Skip to contents

Create a Gauge Chart

Usage

v_gauge(
  vc,
  mapping = NULL,
  data = NULL,
  name = NULL,
  outerRadius = 0.8,
  innerRadius = 0.75,
  startAngle = -240,
  endAngle = 60,
  ...,
  serie_id = NULL,
  data_id = NULL
)

Arguments

vc

A chart initialized with vchart().

mapping

Default list of aesthetic mappings to use for chart.

data

Default dataset to use for chart. If not already a data.frame, it will be coerced to with as.data.frame.

name

Name for the serie, only used for single serie (no color/fill aesthetic supplied).

outerRadius

Sector outer radius, with a numerical range of 0 - 1.

innerRadius

Sector inner radius, with a numerical range of 0 - 1.

startAngle

Starting angle of the sector. In degrees.

endAngle

Ending angle of the sector. In degrees.

...

Additional parameters for the serie.

data_id, serie_id

ID for the data/serie, can be used to further customize the chart with v_specs().

Value

A vchart() htmlwidget object.

Examples


library(vchartr)

vchart() %>%
  v_gauge(aes("My gauge", 0.8))
vchart() %>% v_gauge( aes("My gauge", 0.8), gauge = list( type = "circularProgress", cornerRadius = 20, progress = list( style = list( fill = "forestgreen" ) ), track = list( style = list( fill = "#BCBDBC" ) ) ), pointer = list( style = list( fill = "#2F2E2F" ) ) )
vchart() %>% v_gauge(aes("My gauge", 0.8)) %>% v_scale_y_continuous(labels = ".0%")