Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Manipulate chart.js based plots in R (radarchart)

I use the R package radarchart for plotting interactive radarcharts. I want to manipulate the plot by setting parameters, which are not mentioned in the package manual. Its possible to pass options to chart.js by ... argument by using matching options to http://www.chartjs.org/docs/#getting-started-global-chart-configuration.

labs <- c("Communicator", "Data Wangler", "Programmer", "Technologist", "Modeller", "Visualizer")
scores <- list("Rich" = c(9, 7, 4, 5, 3, 7),
           "Andy" = c(7, 6, 6, 2, 6, 9),
           "Aimee" = c(6, 5, 8, 4, 7, 6))
chartJSRadar(scores=scores, labs=labs)

For example, I tried to change the grid color, but this doesn't work.

chartJSRadar(scores=scores, labs=labs,
         scale=list(gridLines=list(color="black")))
like image 341
pat2402 Avatar asked Jan 21 '26 17:01

pat2402


1 Answers

a little late to this (radarchart author here).

The short answer is that this is a bug. I've made an issue: https://github.com/MangoTheCat/radarchart/issues/39 and will report back when fixed.

Longer answer is in two bits. radarchart only just got updated to use the latest chart.js version (version 2.4.0) so the syntax you would need to update to get the version 2 syntax.

However, the way the optional arguments are nested now means that this still won't work.

The cleanest way to fix it will be in the proposed API changes for the version 1 release. However, if I can add support for it in the mean time I'll post here to update you.

like image 117
dougmet Avatar answered Jan 24 '26 06:01

dougmet