The `PivotStyle` class specifies the styling for headers and cells in a pivot table. Styles are specified in the form of Cascading Style Sheet (CSS) name-value pairs.

Format

R6Class object.

Active bindings

name

The name of the style (for a named style).

declarations

A list containing the style declarations.

Methods

Public methods


Method new()

Create a new `PivotStyle` object.

Usage

PivotStyle$new(parentPivot, styleName = NULL, declarations = NULL)

Arguments

parentPivot

The pivot table that this `PivotStyle` instance belongs to.

styleName

The name of the style (for a named style).

declarations

CSS style declarations in the form of a list, e.g. `list("font-weight"="bold", "color"="#0000FF")`

Returns

A new `PivotStyle` object.


Method setPropertyValue()

Set a single style property.

Usage

PivotStyle$setPropertyValue(property = NULL, value = NULL)

Arguments

property

The name of the style property to set, e.g. "font-weight".

value

The value of the style property to set, e.g. "bold".

Returns

No return value.


Method setPropertyValues()

Set multiple style properties.

Usage

PivotStyle$setPropertyValues(declarations = NULL)

Arguments

declarations

CSS style declarations in the form of a list, e.g. `list("font-weight"="bold", "color"="#0000FF")`

Returns

No return value.


Method getPropertyValue()

Get the value of a single style property.

Usage

PivotStyle$getPropertyValue(property = NULL)

Arguments

property

The name of the style property to set, e.g. "font-weight".

Returns

The value of the style property.


Method asCSSRule()

Get the style definition in the form of a CSS rule.

Usage

PivotStyle$asCSSRule(selector = NULL)

Arguments

selector

A CSS selector, used to select the element(s) to be styled.

Returns

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


Method asNamedCSSStyle()

Get the style definition in the form of a named CSS style.

Usage

PivotStyle$asNamedCSSStyle(styleNamePrefix = NULL)

Arguments

styleNamePrefix

A prefix to prepend to the style name.

Returns

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


Method getCopy()

Create a copy of this `PivotStyle` object.

Usage

PivotStyle$getCopy(newStyleName = NULL)

Arguments

newStyleName

The name of the new style.

Returns

A `PivotStyle` object.


Method asList()

Return the contents of this object as a list for debugging.

Usage

PivotStyle$asList()

Returns

A list of various object properties.


Method asJSON()

Return the contents of this object as JSON for debugging.

Usage

PivotStyle$asJSON()

Returns

A JSON representation of various object properties.


Method clone()

The objects of this class are cloneable with this method.

Usage

PivotStyle$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

# This class should only be created by the pivot table. # It is not intended to be created outside of the pivot table.