VisualizeNumber: Visualizes a number

View source: R/visualizenumber.R

VisualizeNumberR Documentation

Visualizes a number

Description

Shows a number as an htmlwidget. The number can be shown on an oval/rectangle or icon.

Usage

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,
  ...
)

Arguments

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 x).

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 total.icons=ceiling(x/scale).

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 x should be shown. One of "Number", "Percentage", "Percentage (no sign)", Scientific".

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 parameters with override the text.above parameters. If set to "Below", it will override text.below.

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 text.above.outside or text.below.outside is false.

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 "bold" or "normal".

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 should be shown outside the Oval/Rectangle. For Icon/Pictograph, this is always true.

text.below.halign

Horizontal alignment of text.below. There is no control for vertical alignment because it always aligns with the edge of the window.

text.below.pad

Numeric; Vertical space between text.below and edge of shape/icon in pixels.

text.below.xpad

Numeric; Horizontal space between text.below and edge of shape/icon in pixels.

text.below.font.family

Font family of text.below.

text.below.font.color

Font color of text.below.

text.below.font.size

Font size of text.below.

text.below.font.weight

Weight of text.below, i.e. one of "bold" or "normal".

text.above

Text to show above the Oval/Rectangle/Icon/Pictograph.

text.above.outside

Whether text.above should be shown outside the Oval/Rectangle. For Icon/Pictograph, this is always true.

text.above.halign

Horizontal alignment of text.above. There is no control for vertical alignment because it always aligns with the edge of the window.

text.above.pad

Numeric; Vertical space between text.above and edge of shape/icon in pixels.

text.above.xpad

Numeric; Horizontal space between text.above and edge of shape/icon in pixels.

text.above.font.family

Font family of text.above.

text.above.font.color

Font color of text.above.

text.above.font.size

Font size of text.above.

text.above.font.weight

Weight of text.above, i.e. one of "bold" or "normal".

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 display is "Donut" or "Gauge".

tick.outside

Whether to show the ticks inside or outside the gauge.

tick.show

Whether to show the minimum.value and maximum.value when display is "Gauge".

tick.font.family

Font family of tick.

tick.font.color

Font color of tick.

tick.font.size

Font size of tick.

tick.number.type

Format in which x should be shown. One of "Automatic", "Number", "Percentage", "Scientific". If "Automatic" is used, then a percentage format will be used if attr(x, "statistic") or attr(x, "format") is "%". Otherwise a number format will be used.

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 x is expected to take. This value is only used in "Gauge", "Bar" and "Pictograph (single icon)". For "Donut" it is always assumed to be zero.

maximum.value

Numeric value specifying the maximum that x will be expected to take. This value is used to show proportional data (i.e. display is "Donut", "Gauge" or "Pictograph (single icon)").

base.icon.color

Color of the unfilled icons when hide.base.image == FALSE. Defaults to grey (#CCCCCC). Only applicable for built-in icons.

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.icon.color can also be used.

base.opacity

Alpha transparency; only used when display is Donut.

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.text.

hover.font.size

Font size of hover.text.

hover.font.family

Font family of hover.text.

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.

margin.bottom

Spacing below graphic.

...

Other parameters passed to iconWithText.

See Also

PictographChart to create a chart or table of pictographs

Examples

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)

NumbersInternational/flipPictographs documentation built on Feb. 26, 2024, 5:38 a.m.