pictoChart: pictoChart

View source: R/pictochart.R

pictoChartR Documentation

pictoChart

Description

Function that computes dimensions for PictographChart. It should not be called directly. The output is a JSON string for creating the widget

Usage

pictoChart(
  x,
  fill.image,
  base.image = NA,
  image.type = "url",
  total.icons = max(ceiling(x)),
  fill.icon.color = "",
  base.icon.color = "",
  fill.direction = "fromleft",
  show.lines = FALSE,
  show.legend = FALSE,
  legend.text = "",
  icon.nrow = 1,
  icon.ncol = NA,
  label.left = NA,
  label.right = NA,
  label.top = NA,
  label.bottom = NA,
  sublabel.left = NA,
  sublabel.right = NA,
  label.left.pad = 5,
  label.right.pad = 5,
  label.font.family = "arial",
  label.font.size = 12,
  label.font.color = "#2C2C2C",
  label.top.font.family = label.font.family,
  label.top.font.size = label.font.size,
  label.top.font.weight = "normal",
  label.top.font.color = label.font.color,
  label.top.height = NA,
  label.right.font.family = label.font.family,
  label.right.font.size = label.font.size,
  label.right.font.weight = "normal",
  label.right.font.color = label.font.color,
  label.right.width = NA,
  label.bottom.font.family = label.font.family,
  label.bottom.font.size = label.font.size,
  label.bottom.font.weight = "normal",
  label.bottom.font.color = label.font.color,
  label.bottom.height = NA,
  label.left.font.family = label.font.family,
  label.left.font.size = label.font.size,
  label.left.font.weight = "normal",
  label.left.font.color = label.font.color,
  label.left.width = NA,
  label.left.align.horizontal = "right",
  label.right.align.horizontal = "left",
  label.top.align.horizontal = "center",
  label.bottom.align.horizontal = "left",
  label.left.align.vertical = "center",
  label.right.align.vertical = "center",
  label.top.align.vertical = "center",
  label.bottom.align.vertical = "center",
  sublabel.left.font.size = label.left.font.size,
  sublabel.left.font.weight = label.left.font.weight,
  sublabel.left.align.horizontal = label.left.align.horizontal,
  sublabel.right.font.size = label.right.font.size,
  sublabel.right.font.weight = label.right.font.weight,
  sublabel.right.align.horizontal = label.right.align.horizontal,
  legend.font.family = label.font.family,
  legend.font.size = 0.8 * label.font.size,
  legend.font.weight = "normal",
  legend.font.color = label.font.color,
  legend.icon.color = fill.icon.color[1],
  show.label.data = FALSE,
  label.data.text = NULL,
  label.data.position = "footer",
  label.data.font.family = label.font.family,
  label.data.font.size = 0.8 * label.font.size,
  label.data.font.weight = "normal",
  label.data.font.color = label.font.color,
  label.data.align.horizontal = "right",
  show.label.float = FALSE,
  label.float.text = NULL,
  label.float.font.family = label.font.family,
  label.float.font.size = 0.8 * label.font.size,
  label.float.font.weight = "normal",
  label.float.font.color = label.font.color,
  label.float.align.horizontal = "center",
  label.float.align.vertical = "center",
  row.height = NA,
  column.width = NA,
  width.height.ratio = NA,
  background.color = "transparent",
  line.color = "#A8A8A8",
  line.width = 0.5,
  pad.legend = 0.5 * column.width[1],
  pad.row = 2,
  pad.col = 2,
  pad.icon.row = 0,
  pad.icon.col = 0,
  label.vpad = 0,
  f.mspace = 0,
  graphic.width.inch = NA,
  graphic.height.inch = NA,
  graphic.resolution = 72,
  font.whratio = 0.9,
  print.config = FALSE
)

Arguments

x

Data for charting

fill.image

URL of icon

base.image

Optional URL of background image

total.icons

Maximum icons in each table cell. Ignored if both icon.nrow and icon.ncol supplied.

fill.direction

Accepts horizontal, vertical, radial, scale. (But scale may not be appropriate, especially if total.icons is important).

show.lines

Add horizontal lines between each row

show.legend

Show legend (true or false).

legend.text

Text to show beside legend icon.

icon.nrow

Configuration of icons in each table cell. Can be a single value or a vector with length equal to the number of rows.

icon.ncol

Configuration of icons in each table cell. Can be a single value or a vector with length equal to the number of columns.

label.left

Length must be equal to length (if x is a vector) or number of rows (if x is matrix or data.frame) as x. If no value is supplied, labels will be read from names/rowname of x. To suppress labels, use label.left = NULL.

label.right

Optional labels to the right of graphic cells. The length of the labels must be the same as the number of rows in x.

label.top

By default, labels are read from column names of x.

label.bottom

Optional labels below graphic cells. The length of the labels must be the same as the number of columns in x.

label.left.pad, label.right.pad

Horizontal spacing between row labels and icons.

label.font.family

Controls font-family of all labels. To modify only the font of one label use label.left.font.family, label.top.font.family, etc.

label.font.size

Size of label text.

label.font.color

Colour of labels. This can be a string or a 6-digit hex code.

label.top.height

Height of top label row in pixels.

label.left.font.size, label.right.font.size, label.top.font.size, label.bottom.font.size

Font size of row/column labels which overrides the global label.font.size setting.

label.left.font.weight, label.right.font.weight, label.top.font.weight, label.bottom.font.weight

Font weight of row/column labels which overrides the global label.font.weight setting.

label.left.font.color, label.right.font.color, label.top.font.color, label.bottom.font.color

Font color of row/column labels which overrides the global label.font.color setting.

label.left.width

Width of left label column in pixels.

label.left.align.horizontal, label.right.align.horizontal, label.top.align.horizontal, label.bottom.align.horizontal

Horizontal alignment of row and column labels. One of "left", "right" or "center".

label.left.align.vertical, label.right.align.vertical, label.top.align.vertical, label.bottom.align.vertical

Vertical alignment of row and column labels. One of "top", "bottom" or "center".

legend.font.size

Text size of legend text.

legend.icon.color

Color of icon shown in legend.

label.data.font.family

Font in which the data labels are displayed.

label.data.font.size

Font size of data labels.

label.data.font.weight

Weight of data labels, i.e. one of "bold" or "normal".

label.data.font.color

Font color of data labels.

label.data.align.horizontal

Horizontal alignment of data labels.

row.height

Height of graphic cells. Can be a single value or a character or numeric vector the same length as the number of rows in x.

column.width

Width of graphic cells.

width.height.ratio

Width-to-height ratio used to adjust row heights and column widths so they match the aspect ratio of the icon. Mis-specfication does not distort icon, but graphic will have extra spacing. When set to zero, row.height and column.width are unchanged, otherwise initial values are decreased to match width.height.ratio.

background.color

Background colour of pictograph

line.color

Line colour

line.width

Width of lines

pad.legend

Horizontal spacing between the chart and the legend.

pad.row

Single numeric specifying vertical spacing between graphic cells in the table.

pad.col

Vertical spacing between cells in table.

pad.icon.row

Numeric specifying vertical spacing between icons inside each table cell. May be a single value or a numeric matrix of the same dimensions as x.

f.mspace

Space in left/right margin left for floating labels. This parameter is adjusted iteratively by PictographChart when floating labels are used in bar pictographs.

graphic.width.inch

Horizontal dimension of the chart output in inches. If these dimensions are not specified, the width-to-height ratio of the chart output may not match the desired dimensions.

graphic.height.inch

Verical dimension of the chart output in inches.

font.whratio

Numeric specifying the average aspect ratio of a single character, which usually varies around 0.4 - 0.6. It is used to calculate the minimum width of the labels.

legend.font.family.family

Font of legend.

pad.icon.ncol

Horizontal spacing between icons inside each table cell.

Value

Either a JSON string to create the widget or NA or a numeric value (see parameter f.mspace) if adjustment of dimensions is required to fit the floating labels in properly. The iterative adjustment is performed only when graphic.width.inch and graphic.height.inch is provided.


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