amGaugeChart | R Documentation |
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, animated = TRUE, backgroundColor = NULL, caption = NULL, image = NULL, width = NULL, height = NULL, export = FALSE, chartId = NULL, elementId = NULL )
score |
gauge value, a number between |
minScore |
minimal score |
maxScore |
maximal score |
scorePrecision |
an integer, the number of decimals of the score to be displayed |
gradingData |
data for the gauge, a dataframe with three required
columns: |
innerRadius |
inner radius of the gauge given as a percentage,
between |
labelsRadius |
radius for the labels given as a percentage; use the default value to get centered labels |
axisLabelsRadius |
radius for the axis labels given as a percentage |
chartFontSize |
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
|
labelsFont |
a list of settings for the font of the labels created with
|
axisLabelsFont |
a list of settings for the font of the axis labels
created with |
scoreFont |
a list of settings for the font of the score created with
|
scoreLabelFont |
a list of settings for the font of the score label
created with |
hand |
a list of settings for the hand of the gauge created with
|
gridLines |
a list of settings for the grid lines created with
|
chartTitle |
chart title, it can be |
theme |
theme, |
animated |
Boolean, whether to animate the rendering of the graphic |
backgroundColor |
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. |
caption |
|
image |
option to include an image at a corner of the chart;
|
width |
the width of the chart, e.g. |
height |
the height of the chart, e.g. |
export |
logical, whether to enable the export menu |
chartId |
a HTML id for the chart |
elementId |
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 |
In Shiny, you can change the score of a gauge chart with the help of
updateAmGaugeChart
.
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 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.