I would like the tooltips to read "one, two, three", instead of "0, 1, 2" in this sparkline plot created with the R sparkline package.
Although I don't see this anywhere in the sparkline documentation, I see from some examples online that the offset variable for a bar chart refers to the x-axis values.
I am trying to map the offset values using the tooltipValueLookups argument. What am I doing wrong?
library(sparkline)
sparkline(
values = c(3, 5, 2), type = "bar", barWidth = 20,
tooltipFormat = "{{offset:names}}",
tooltipValueLookups = "{names: {0:'one', 1:'two', 2:'three'}}"
)

I figured it out!
The
tooltipValueLookupsargument can accept a list and thetooltipFormatargument can specify the relationship between the offset (x-axis value) and the named element oftooltipValueLookups.sparklines are really cool but unfortunately as a user, one has to navigate both the R and JS documentation and sometimes guess how they relate.