| PivotStyles | R Documentation |
The 'PivotStyles' class is a collection of 'PivotStyle' objects. It defines all of the base styles needed to style/theme a pivot table. It also defines the names of the styles that are used for styling the different parts of the pivot table.
R6Class object.
countThe number of 'PivotStyle' objects in this 'PivotStyles' collection.
themeA theme name to represent this collection of styles.
stylesA list containing the 'PivotStyle' objects in this 'PivotStyles' collection.
allowExternalStylesDefault 'FALSE', which means this 'PivotStyles' object checks that style names specified for styling the different parts of the pivot table must exist in the styles collection. If they do not an error will occur. Specify 'TRUE' to disable this check, e.g. if the style definitions are not managed by 'pivottabler' but instead in an external system.
tableStyleThe name of the style for the HTML table element.
rootStyleThe name of the style for the HTML cell at the top left of the pivot table.
rowHeaderStyleThe name of the style for the row headers in the pivot table.
colHeaderStyleThe name of the style for the column headers in the pivot table.
outlineRowHeaderStyleThe name of the style for the outline row headers in the pivot table.
outlineColHeaderStyleThe name of the style for the outline column headers in the pivot table.
cellStyleThe name of the cell style for the non-total cells in the body of the pivot table.
outlineCellStyleThe name of the cell style for the non-total outline cells in the body of the pivot table.
totalStyleThe name of the cell style for the total cells in the pivot table.
new()Create a new 'PivotStyles' object.
PivotStyles$new(parentPivot, themeName = NULL, allowExternalStyles = FALSE)
parentPivotThe pivot table that this 'PivotStyles' instance belongs to.
themeNameA theme name to represent this collection of styles.
allowExternalStylesDefault 'FALSE', which means this 'PivotStyles' object checks that style names specified for styling the different parts of the pivot table must exist in the styles collection. If they do not an error will occur. Specify 'TRUE' to disable this check, e.g. if the style definitions are not managed by 'pivottabler' but instead in an external system.
A new 'PivotStyles' object.
isExistingStyle()Check whether a style with the specified style name exists in the collection.
PivotStyles$isExistingStyle(styleName = NULL)
styleNameThe name of the style.
'TRUE' if a style with the specified name exists, 'FALSE' otherwise.
getStyle()Retrieve a style with the specified style name.
PivotStyles$getStyle(styleName = NULL)
styleNameThe name of the style.
A 'PivotStyle' object.
addStyle()Add a new style to the collection of styles.
PivotStyles$addStyle(styleName = NULL, declarations = NULL)
styleNameThe name of the new style.
declarationsCSS style declarations in the form of a list, e.g. 'list("font-weight"="bold", "color"="#0000FF")'
The newly created 'PivotStyle' object.
copyStyle()Create a copy of a style with the specified name and store it in the collection.
PivotStyles$copyStyle(styleName = NULL, newStyleName = NULL)
styleNameThe name of the style to copy.
newStyleNameThe name for the new style.
The newly created 'PivotStyle' object.
asCSSRule()Get a style definition in the form of a CSS rule.
PivotStyles$asCSSRule(styleName = NULL, selector = NULL)
styleNameThe name of the style.
selectorA CSS selector, used to select the element(s) to be styled.
The style declarations in the form of a CSS rule, i.e. selector property-name1: property-value1, property-name2: property-value2, ... e.g. div font-weight: bold, color: #0000FF
asNamedCSSStyle()Get a style definition in the form of a named CSS style.
PivotStyles$asNamedCSSStyle(styleName = NULL, styleNamePrefix = NULL)
styleNameThe name of the style.
styleNamePrefixA prefix to prepend to the style name.
The style declarations in the form of named CSS style, i.e. .prefix-stylename property-name1: property-value1, property-name2: property-value2, ... e.g. .pvt1Cell font-weight: bold, color: #0000FF
asList()Return the contents of this object as a list for debugging.
PivotStyles$asList()
A list of various object properties.
asJSON()Return the contents of this object as JSON for debugging.
PivotStyles$asJSON()
A JSON representation of various object properties.
asString()Return a representation of this object as a character value.
PivotStyles$asString(seperator = ", ")
seperatorA character value to use when concatenating multiple styles.
A character summary of various object properties.
clone()The objects of this class are cloneable with this method.
PivotStyles$clone(deep = FALSE)
deepWhether to make a deep clone.
pt <- PivotTable$new()
# ...
pivotStyles <- PivotStyles$new(pt, themeName="compact")
pivotStyles$addStyle(styleName="MyNewStyle", list(
font="0.75em arial",
padding="2px",
border="1px solid lightgray",
"vertical-align"="middle",
"text-align"="center",
"font-weight"="bold",
"background-color"="#F2F2F2"
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.