50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


rAmCharts (version 2.0.2)

addListener: AmObject methods

Description

Methods for inherited classes.

Usage

addListener(.Object, name, expression)
"addListener"(.Object, name, expression)
setProperties(.Object, list_prop, ...)
"setProperties"(.Object, list_prop, ...)

Arguments

.Object
AmObject.
name
character, name of the listener.
expression
character, associated function event.
list_prop
(Optional) list containing properties to set. The former properties will be overwritten.
...
other properties

Value

The updated object.

Details

Former properties will be overwritten.

Examples

Run this code
addListener(.Object = amPieChart(),
            name = "clickSlice" ,
            expression = "function(event){ alert('ok !'); }")
            
addListener(.Object = amLegend(),
            name = "select",
            expression = paste0("function onSelect (properties) {",
                                "alert('selected nodes: ' + properties.nodes);",
                                "}"))

library(pipeR)
# either you can set a list
ls <- list(categoryAxis = list(gridPosition = "start"), fontSize = 15)
amSerialChart() %>>% setProperties(list = ls)  %>>% print()

# or you can set one or more properties
amPieChart() %>>% setProperties(handDrawn = TRUE, fontSize = 15) %>>% print()

# overwrite a property
amPieChart() %>>%  setProperties(fontSize = 15) %>>%  setProperties(fontSize = 12) %>>% print()

# Carefull if you try to set a property which is a slot...
# in that case, use the setter methods 'setXX' or 'addXX' which check the validity
## Not run: 
# amPieChart() %>>% setProperties(type = "serial") %>>% print()
# ## End(Not run)

amPieChart() %>>% setExport()

Run the code above in your browser using DataLab