The following code works:
tooltipOpts: {
content: "%s : %y",
shifts: {
x: -30,
y: -50
}
}
I am trying to show some dynamically calculated data in "content" so am trying to use a function. Even my most basic example isn't working, I get error shown below:
tooltipOpts: {
content: function() {
return "%s : %y";
},
shifts: {
x: -30,
y: -50
}
}
Uncaught TypeError: Object function () {
return "%s : %y";
} has no method 'replace'
I'll assume you are using the tooltip plugin from here. I've coded up a fiddle example, here, that uses the
function
format of thecontent
property. Note that your callback signature it incorrect:But even without those arguments, I couldn't reproduce your error.