Replies: 1 comment
-
The optionsRaw() method passes things down the wire without modification, so thats the best way to pass in raw JavaScript. The downside is that you need the whole optionsRaw() payload to be formatted as json, but once you’re using Javasript inside labels, then it makes sense to go all in and use json.On 13 Feb 2025, at 6:37 AM, Preben Liland Madsen ***@***.***> wrote:
Hi, is there a way to add raw javascript as a value when using the build->options()
For instance, I would try:
'tooltip' => [
'callbacks' => [
'label' => 'function(context) {
let label = context.dataset.label || "";
if (label) {
label += ": ";
}
if (context.parsed.y !== null) {
label += context.parsed.y + ". rank in the list";
}
return label;
}'
]
],
But since values is safely escaped to the template by default this wouldn't work. Is there a way I can tell it that the value is raw js and should not be escaped?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, is there a way to add raw javascript as a value when using the build->options()
For instance, I would try:
'tooltip' => [
'callbacks' => [
'label' => 'function(context) {
let label = context.dataset.label || "";
if (label) {
label += ": ";
}
if (context.parsed.y !== null) {
label += context.parsed.y + ". rank in the list";
}
return label;
}'
]
],
But since values is safely escaped to the template by default this wouldn't work. Is there a way I can tell it that the value is raw js and should not be escaped?
Beta Was this translation helpful? Give feedback.
All reactions