I created a highchart and hope to pass the point information (name, description etc...) into another function. However I can't seem to find a way to access the point name. Below is my current attempt.
# Generate chart
highchart() %>%
hc_chart(type = 'organization', inverted = TRUE) %>%
hc_title(text = sprintf('%s Org Chart', chartName)) %>%
hc_add_series(
name = chartName,
data = hierarchyList,
nodes = nodeList,
colorByPoint = FALSE,
color = '#D6E8F3',
dataLabels = list(color = 'black',
nodeFormat = getNodeFormat("{point.image}", "{point.name}", "{point.title}", "{point.description}", ...),
borderColor = 'white',
nodeWidth = 190
) %>%
hc_tooltip(outside = TRUE)
}
getNodeFormat <- function(image, name, title, description...) {
... #more codes here
}
In the getNodeFormat
function, there are other computations and data accessing that requires the actual name string of the point. However, when I try to print out name
in getNodeFormat, it displays "{point.name}" instead of the actual name of the point.
Other attempts instead of "{point.name}"
are point.name
, and {point.name}
. None of them worked and the error stated "object not found".
Is there a way where I can access the point information directly? Any help will be appreciated!