0

The standard example of the rChartsCalendar works with defaults of the JS calendar as shown in http://kamisama.github.io/cal-heatmap/

The example code below works fine:

dat <- read.csv('http://t.co/mN2RgcyQFc')[,c('date', 'pts')]

library(rChartsCalendar)
r1 <- plotCalMap(x = 'date', y = 'pts',
             data = dat, 
             domain = 'month',
             start = "2012-10-27",
             legend = seq(10, 50, 10),
             itemName = 'point',
             range = 7
)

The problem comes when I try to set nested attributes in R, for example to define the position and the offset of the label. In HTML / JS it would be as easy as writing following code, but how can I define from R the values for the offset for the label?

var cal = new CalHeatMap();
cal.init({
    itemSelector: "#label-d",
    domain: "day",
    range: 2,
    displayLegend: false,
    label: {
        position: "right",
        width: 46,
        offset: {x: 10, y: 30}
    }
});

I tried using the method set and passing the json piece as string, but then it gets rendered with the quotes in HTML/JS, which obviously doesn't work

r1$set(label="{position: 'left', width: 110, offset: { x: 20, y: 12  }   }")
Juan Bernabe
  • 241
  • 2
  • 2

1 Answers1

0

Update: I got it working using a combination of "c" and "list" as follows:

label= c( list(position = 'left'),list( width = 110),list(offset = list (x=20,y=30))),

It's not very straight away, but I felt like sharing it because it took me a lot of time

Juan Bernabe
  • 241
  • 2
  • 2