Learn R Programming

sparkTable (version 1.3.0)

setParameter: Functions to interact with a Sparkline object

Description

Basic functions to set parameters for objects of class 'sparkline', 'sparkbar', 'sparkbox', 'sparkTable' or 'geoTable'.

Usage

setParameter(object, value, type)

Arguments

object
objects of class 'sparkline', 'sparkbar', 'sparkbox', 'sparkTable' or 'geoTable'
type
one of the following:
  • 'width': set/change slot 'width' for objects of class 'spark' and classes that directly extend this class.
  • 'height': set/change slot 'height' for objects of class 'spark' and classes that directly extend this class.
  • 'values': set/change slot 'values' for objects of class 'spark' and classes that directly extend this class.
  • 'padding': set/change slot 'padding' for objects of class 'spark' and classes that directly extend this class.
  • 'allColors': set/change slot 'allColors' for objects of class 'sparkline'.
  • 'lineWidth': set/change slot 'lineWidth' for objects of class 'sparkline'.
  • 'pointWidth': set/change slot 'pointWidth' for objects of class 'sparkline'.
  • 'showIQR': set/change slot 'showIQR' for objects of class 'sparkline'.
  • 'boxCol': set/change slot 'boxCol' for objects of class 'sparkbox'.
  • 'outCol': set/change slot 'outCol' for objects of class 'sparkbox'.
  • 'boxLineWidth': set/change slot 'boxLineWidth' for objects of class 'sparkbox'.
  • 'barCol': set/change slot 'barCol' for objects of class 'sparkbar'.
  • 'barSpacingPerc': set/change slot 'barSpacingPerc' for objects of class 'sparkbar'.
  • 'bgCol': set/change slot 'bgCol' for objects of class 'sparkbar','sparkhist' and 'sparkbox'.
  • 'dataObj': set/change slot 'dataObj' for objects of class 'sparkTable' or 'geoTable'.
  • 'tableContent': set/change slot 'tableContent' for objects of class 'sparkTable' or 'geoTable'.
  • 'varType': set/change slot 'varType' for objects of class 'sparkTable' or 'geoTable'.
  • 'geographicVar': set/change slot 'geographicVar' for objects of class 'geoTable'.
  • 'geographicInfo': set/change slot 'geographicInfo' for objects of class 'geoTable'.
  • 'geographicOrder': set/change slot 'geographicOrder' for objects of class 'geoTable'.
value
values that are used to updated the slot chosen with argument 'type':
  • if type=='width': numeric vector of length 1 defining the width of the resulting plot
  • if type=='height': numeric vector of length 1 defining the height of the resulting plot
  • if type=='values': numeric vector defining the values to be plotted
  • if type=='padding': numeric vector of length 4 defining the padding of the plot in percent. The order is: top,bottom,left,right.
  • if type=='allColors': a character vector of length 6 (including NA's) containing colors. The elements of the color vector are used as:
    • first element: color for minimal value
    • second element: color for maximal value
    • third element: color for last value
    • fourth element: color for filling
    • fifth element: color for the line
    • sixth element: color for interquartil range

  • if type=='lineWidth': numeric vector of length 1 defining the line width of the resulting sparkline
  • if type=='pointWidth': numeric vector of length 1 defining the width of points (min, max, last) of the resulting sparkline.
  • if type=='showIQR': logical vector of length 1 defining if the IQR of the data should be plotted in the sparkline.
  • if type=='boxCol': character vector of length 2 defining colors to be used in a sparkbox plot.
    • first element: color of the lines surrounding the boxes
    • second element: fill color of the box

  • if type=='outCol': character vector of length 1 defining the color of outliers in a sparkboxplot.
  • if type=='bgCol': character vector of length 1 defining the color of the plot background.
  • if type=='boxLineWidth': numeric vector of length 1 defining the width of the surrounding lines of a sparkboxplot.
  • if type=='barCol': character vector of length 3 defining colors to be used in a sparkbar plot.
    • first element: color of bars showing negative values
    • second element: color of bars showing positive values
    • third element: color of lines in the plot

  • if type=='barSpacingPerc': numeric vector of length 1 defining the spacing in percent used between the bars in the sparkbar plot
  • if type=='dataObj': a data frame containing information to be plotted.
  • if type=='tableContent': a list with elements of class 'sparkline','sparkbox','sparkbar' or 'function'
  • if type=='varType': a character vector containing variable names existing in dataObj.
  • if type=='geographicVar': a character variable of length 1 with a variable name of dataObj that holds regional information.
  • if type=='geographicInfo': a data.frame with information on coordinates of regions to be plotted.
  • if type=='geographicOrder': a data.frame containing 3 columns that is usually automatically created.
    • first column: row-indices
    • second column: column-indices
    • third column: regional codes

See Also

getParameter

Examples

Run this code
  data(pop)
  x <- pop[pop[,2]=="Insgesamt",3]
  a <- newSparkLine(values=x, pointWidth=8)
  
  a <- setParameter(a, type='values', value=sample(1:10, 15, replace=TRUE))
  getParameter(a, 'values')

  a <- setParameter(a, type='allColors',
    value=c("darkred", "darkgreen","darkblue", "white", "black", "red"))
  getParameter(a, 'allColors')

  getParameter(a, 'pointWidth')
  a <- setParameter(a, type='pointWidth', value=3)
  getParameter(a, 'pointWidth')
 
  a <- setParameter(a, type='lineWidth', value=1)
  a <- setParameter(a, type='width', value=6)
  a <- setParameter(a, type='height', value=.6)

Run the code above in your browser using DataLab