First, you should load recharts:

library(recharts)

1 Introduction

Gauge is also known as dashboard.

The keys are:

  • character x
  • numeric y
  • character facet to yield multiple gauges
  • t if you want the gauge change

2 Function Call

echartr(data, x, y, <series>, <facet>, <t>, <type>)
Arg Requirement

data

source data in the form of data.frame

x

character independent variable. Only the first one is accepted if multiple variables are provided.

y

numeric dependent variable. Only the first one is accepted.

series

series variable which will be coerced to factors. Each level of series is treated as a subsetting factor to produce. Only the first one is accepted if multiple variables are provided.

facet

facetting variable which will be coerced to factors. Each level of facet is treated as a subsetting factor to produce separate gauges. Only the first one is accepted if multiple variables are provided.

t

timeline variable which will be coerced to factors. Only the first one is accepted if multiple variables are provided.

type

‘gauge’

3 Showcase

3.1 Data Preparation

Here is a fictious dataset.

data = data.frame(x=rep(c('KR/min', 'Kph'), 2), y=c(6.3, 54, 7.5, 82), 
                  z=c(rep('t1', 2), rep('t2', 2)))
knitr::kable(data)
x y z
KR/min 6.3 t1
Kph 54.0 t1
KR/min 7.5 t2
Kph 82.0 t2

3.2 Single Gauge

echartr(data, x, y, type='gauge')

3.3 Multiple Gauges

echartr(data, x, y, facet=x, type='gauge')

3.4 With Timeline

echartr(data, x, y, facet=x, t=z, type='gauge')

4 Futher Setup

Then you can configure the widgets, add markLines and/or markPoints, fortify the chart.

You can refer to related functions to play around on your own.