updateCharts: Update a chart

Description Usage Arguments Details Update types Examples

View source: R/lc.R

Description

updateCharts redraws a chart or a single layer of a chart to make it up to date with the current state of the environment variables.

Usage

1
updateCharts(chartId = NULL, layerId = NULL, updateOnly = NULL)

Arguments

chartId

ID of the chart to be updated (or vector of IDs). If NULL, all the existing charts will be updated.

layerId

ID of the layer to be updated (or vector of IDs). If NULL, all the layers of the selected charts will be updated. To update only some layers of multiple charts the lengths of chartId and layerId must be the same.

updateOnly

To improve performance it may be useful to change only certain aspects of a chart (e.g. positions of points, colour of heatmap cells, etc.). This argument can specify which part of chart to update. Possible options are Elements, ElementPosition, ElementStyle, Axes, Labels, Cells, Texts, LabelPosition, CellPosition, TextPosition, LabelText, CellColour, TextValues, Canvas, Size. See details for more information.

Details

Linked charts of the rlc package are based on the idea that the variables that are used to define a chart are not constant, but can change as a result of user's actions. Each time the updateCharts function is called, all the properties that were set inside the dat function are re-evaluated and the chart is redrawn in accordance with the new state.

If this function is called from the R session, changes will be applied to all currently opened pages. If it is used as a part of any rlc callback, only the page that triggered the call will be affected.

This function is a wrapper around method updateCharts of class LCApp.

Update types

To improve performance you can update only a certain part of a chart (e.g. colours, size, etc.). This can be done by setting the updateOnly argument. Here are all possible values for this argument.

These are valid for all the charts:

These can be updated only in heatmaps (lc_heatmap):

These aspects are present in all the charts with axes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data(iris)

#store some properties in global variables
width <- 300
height <- 300
colour <- iris$Sepal.Width
#create a chart
lc_scatter(dat(x = iris$Sepal.Length, y = iris$Petal.Length, colourValue = colour,
               width = width, height = height), chartId = "iris")

#change the variables
height <- 400
colour <- iris$Petal.Width

#this will change colour of points and chart height
updateCharts("iris")
#this will change only height
updateCharts("iris", updateOnly = "Size")

#add another property
setProperties(dat(symbolValue = iris$Species), "iris")
#this will change only colour and symbols
updateCharts("iris", updateOnly = "ElementStyle")

rlc documentation built on Jan. 5, 2022, 1:11 a.m.