Create a HTML widget displaying a gauge chart.
amGaugeChart(
score,
minScore,
maxScore,
scorePrecision = 0,
gradingData,
innerRadius = 70,
labelsRadius = (100 - innerRadius)/2,
axisLabelsRadius = 19,
chartFontSize = 11,
labelsFont = amFont(fontSize = "2em", fontWeight = "bold"),
axisLabelsFont = amFont(fontSize = "1.2em"),
scoreFont = amFont(fontSize = "6em"),
scoreLabelFont = amFont(fontSize = "2em"),
hand = amHand(innerRadius = 45, width = 8, color = "slategray", strokeColor =
"black"),
gridLines = FALSE,
chartTitle = NULL,
theme = NULL,
backgroundColor = NULL,
caption = NULL,
image = NULL,
width = NULL,
height = NULL,
export = FALSE,
chartId = NULL,
elementId = NULL
)
gauge value, a number between minScore
and
maxScore
minimal score
maximal score
an integer, the number of decimals of the score to be displayed
data for the gauge, a dataframe with three required
columns: label
, lowScore
, and highScore
, and an
optional column color
; if the column color
is not present,
then the colors will be derived from the theme
inner radius of the gauge given as a percentage,
between 0
(the gauge has no width) and 100
(the gauge is
a semi-disk)
radius for the labels given as a percentage; use the default value to get centered labels
radius for the axis labels given as a percentage
reference font size, a numeric value, the font size in
pixels; this font size has an effect only if you use the relative CSS unit
em
for other font sizes
a list of settings for the font of the labels created with
amFont
, but the font size must be given in pixels or in
em
CSS units (no other units are accepted)
a list of settings for the font of the axis labels
created with amFont
a list of settings for the font of the score created with
amFont
a list of settings for the font of the score label
created with amFont
a list of settings for the hand of the gauge created with
amHand
a list of settings for the grid lines created with
amLine
, or a logical value: FALSE
for no grid lines,
TRUE
for default grid lines
theme, NULL
or one of "dataviz"
,
"material"
, "kelly"
, "dark"
, "moonrisekingdom"
,
"frozen"
, "spiritedaway"
, "patterns"
,
"microchart"
a color for the chart background; it can be given by
the name of a R color, the name of a CSS
color, e.g. "aqua"
or "indigo"
, an HEX code like
"#ff009a"
, a RGB code like "rgb(255,100,39)"
, or a HSL code
like "hsl(360,11,255)"
option to include an image at a corner of the chart;
NULL
or FALSE
for no image, otherwise a named list with four
possible fields: the field image
(required) is a list created with
amImage
,
the field position
can be "topleft"
, "topright"
,
"bottomleft"
or "bottomright"
, the field hjust
defines the horizontal adjustment, and the field vjust
defines
the vertical adjustment
the width of the chart, e.g. "600px"
or "80%"
;
ignored if the chart is displayed in Shiny, in which case the width is
given in amChart4Output
the height of the chart, e.g. "400px"
;
ignored if the chart is displayed in Shiny, in which case the height is
given in amChart4Output
logical, whether to enable the export menu
a HTML id for the chart
a HTML id for the container of the chart; ignored if the chart is displayed in Shiny, in which case the id is given by the Shiny id
# NOT RUN {
library(rAmCharts4)
gradingData <- data.frame(
label = c("Slow", "Moderate", "Fast"),
color = c("blue", "green", "red"),
lowScore = c(0, 100/3, 200/3),
highScore = c(100/3, 200/3, 100)
)
amGaugeChart(
score = 40, minScore = 0, maxScore = 100, gradingData = gradingData
)
# }
Run the code above in your browser using DataLab