View source: R/visualizenumber.R
VisualizeNumber | R Documentation |
Shows a number as an htmlwidget. The number can be shown on an oval/rectangle or icon.
VisualizeNumber(
x,
display = c("Oval", "Rectangle", "Number", "Icon", "Donut", "Gauge", "Pictograph")[1],
fill.color = rgb(166, 197, 57, maxColorValue = 255),
fill.opacity = 0.4,
total.icons = NA,
global.font.family = "Arial",
global.font.color = "#808080",
label.data.number.type = c("Automatic", "Number", "Percentage", "Scientific")[1],
label.data.decimals = 0,
label.data.1000.separator = ",",
label.data.position = "Overlay",
label.data.prefix = "",
label.data.suffix = "",
label.data.valign = "middle",
label.data.halign = "center",
label.data.pad = 0,
label.data.xpad = 0,
label.data.font.family = global.font.family,
label.data.font.color = global.font.color,
label.data.font.size = 16,
label.data.font.weight = "normal",
text.below = "",
text.below.outside = TRUE,
text.below.halign = "center",
text.below.pad = 0,
text.below.xpad = 0,
text.below.font.family = global.font.family,
text.below.font.color = global.font.color,
text.below.font.size = 10,
text.below.font.weight = "normal",
text.above = "",
text.above.outside = TRUE,
text.above.halign = "center",
text.above.pad = 0,
text.above.xpad = 0,
text.above.font.family = global.font.family,
text.above.font.color = global.font.color,
text.above.font.size = 10,
text.above.font.weight = "normal",
border.color = rgb(0.5, 0.5, 0.5),
border.opacity = 0.5,
border.width = 0,
border.resolution = 1000,
segment.gap = 0,
hole.size = 0.8,
tick.outside = TRUE,
tick.show = TRUE,
tick.font.family = global.font.family,
tick.font.color = global.font.color,
tick.font.size = 8,
tick.number.type = label.data.number.type,
tick.decimals = label.data.decimals,
tick.1000.separator = label.data.1000.separator,
tick.prefix = "",
tick.suffix = "",
minimum.value = 0,
maximum.value = NA,
base.icon.color = "",
base.color = base.icon.color,
base.opacity = fill.opacity,
background.color = rgb(1, 1, 1),
background.opacity = 0,
hover.text = "",
hover.distance = 0.2,
hover.bg.color = rgb(0.5, 0.5, 0.5),
hover.font.color = rgb(1, 1, 1),
hover.font.size = 9,
hover.font.family = global.font.family,
font.unit = "pt",
margin.left = 0,
margin.right = 0,
margin.top = 0,
margin.bottom = 0,
...
)
x |
The number to display |
display |
A string describing the visualization output. This can be simply "Number"; or
a number on a shape ("Oval", "Rectangle", "Donut", "Gauge"); or a number on top of an "Icon";
or a "Pictograph" (where the amount of icons filled reflects the size of |
fill.color |
Color of the shape (Oval or Rectangle) or the icon (for Icon or Pictograph) if custom.icon is not used. |
fill.opacity |
Alpha transparency of the Oval or Rectangle. |
total.icons |
Total number of icons. Defaults to |
global.font.family |
Character; font family for all occurrences of any font attribute for the chart unless specified individually. |
global.font.color |
Global font color as a named color in character format (e.g. "black") or an a hex code. |
label.data.number.type |
Format in which |
label.data.decimals |
Integer; Number of decimals shown in data label. |
label.data.1000.separator |
String placed to separate thousands. By default this is a comma. Set to empty string to hide. |
label.data.position |
This is only used for Icon or Pictograph. It can be one of
"Above", "Below" or "Overlay" (i.e. on to top of the icons). For oval/rectangle it
is always "Overlay". If it is set to "Above", then the |
label.data.prefix |
String to prepend data label. |
label.data.suffix |
String to append to data label. |
label.data.valign |
Vertical alignment of data label. One of "top", "middle", "bottom".
This is ignored if |
label.data.halign |
Horizontal alignment of data label. One of "left", "center or "right". |
label.data.pad |
Vertical space between data label and the edge of the shape/icon in pixels. |
label.data.xpad |
Horizontal space between data label and the edge of the shape/icon in pixels. |
label.data.font.family |
Font in which the data labels are displayed. |
label.data.font.color |
Font color of data labels. |
label.data.font.size |
Font size of data labels. |
label.data.font.weight |
Weight of data labels, i.e. one of |
text.below |
Text to show below the Oval/Rectangle/Icon/Pictograph. For Oval and Rectangle add "<br>" to add new lines to the text. |
text.below.outside |
Whether |
text.below.halign |
Horizontal alignment of |
text.below.pad |
Numeric; Vertical space between |
text.below.xpad |
Numeric; Horizontal space between |
text.below.font.family |
Font family of |
text.below.font.color |
Font color of |
text.below.font.size |
Font size of |
text.below.font.weight |
Weight of |
text.above |
Text to show above the Oval/Rectangle/Icon/Pictograph. |
text.above.outside |
Whether |
text.above.halign |
Horizontal alignment of |
text.above.pad |
Numeric; Vertical space between |
text.above.xpad |
Numeric; Horizontal space between |
text.above.font.family |
Font family of |
text.above.font.color |
Font color of |
text.above.font.size |
Font size of |
text.above.font.weight |
Weight of |
border.color |
Color of the border around "Oval" or "Rectangle") |
border.opacity |
Opacity of border, which should be between 0 and 1. |
border.width |
Width of the border as a proportion of the graphic dimensions. |
border.resolution |
The number of points used to define the border of the circle. |
segment.gap |
Numeric between 0 and 1, specifying the gap between the segments in the gauge. |
hole.size |
Numeric between 0 and 1, specifying the size of the hole when |
tick.outside |
Whether to show the ticks inside or outside the gauge. |
tick.show |
Whether to show the |
tick.font.family |
Font family of |
tick.font.color |
Font color of |
tick.font.size |
Font size of |
tick.number.type |
Format in which |
tick.decimals |
Integer; Number of decimals shown in ticks |
tick.1000.separator |
String placed to separate thousands. By default this is a comma. Set to empty string to hide. |
tick.prefix |
Optional text to prepend to ticks. |
tick.suffix |
Optional text to append to ticks. |
minimum.value |
Numeric value specifying the minimum value that |
maximum.value |
Numeric value specifying the maximum that |
base.icon.color |
Color of the unfilled icons when |
base.color |
The color of the base graphic when a Pictograph (with the base image shown)
or a Donut is displayed. For backwards compatibility, |
base.opacity |
Alpha transparency; only used when |
background.color |
Color of the graphic background |
background.opacity |
Transparency of background (0 to 1). This is only valid for Number, Oval or Rectangle. |
hover.text |
Optional text to show when the cursor hovers above widget. |
hover.distance |
Deprecated. |
hover.bg.color |
Color of the background of the hovertext. |
hover.font.color |
Font color of |
hover.font.size |
Font size of |
hover.font.family |
Font family of |
font.unit |
Set to 'pt' (default) to get font sizing consistent with textboxes. Otherwise fonts will be taken to be specified in pixels. |
margin.left |
Spacing on the left of the graphic. |
margin.right |
Spacing on the right of the graphic. |
margin.top |
Spacing on top of graphic. This value overrides |
margin.bottom |
Spacing below graphic. |
... |
Other parameters passed to |
PictographChart to create a chart or table of pictographs
VisualizeNumber(4.0, display = "Rectangle", text.above = "Above", text.above.outside = TRUE)
VisualizeNumber(7.0, display = "Oval", label.data.prefix = "Number: ", label.data.suffix = ".",
label.data.valign = "bottom", label.data.halign = "right", label.data.pad = 30)
VisualizeNumber(Sys.Date(), text.above = "The date is", text.below = "today.",
global.font.color = "white", text.above.font.size = 10, text.below.font.size = 10,
label.data.font.size = 20, background.color = "grey", background.opacity = 1.0)
VisualizeNumber(-7, text.below = "FROZEN<br>FOODS", global.font.color = "white",
text.above.font.size = 10, text.below.font.size = 10, label.data.font.size = 20,
background.color = "grey", background.opacity = 1.0, text.above.outside = FALSE,
text.below.outside = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.