You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Everyone!
In this very example, trying to format y axes as well as tooltip values with currency format.
Ultimately, I also want to use JavaScript to make some of the series clickable.. etc.
As per this gem documentation, this normally is possible:
You can put anything in the options hash that Chart.js recognises. To pass a JavaScript function as an option value, wrap it in quotation marks to make it a string.
In practice, I don't seem to be able to make it work.
Is this a know bug/issue?
Should I be doing this differently?
Alternatively, is there any way to access the ctx and chart variables from the generated script, so I can eventually attach these callbacks in raw JS, in the case this gem doesn't allow it?
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Hi Everyone!
In this very example, trying to format y axes as well as tooltip values with currency format.
Ultimately, I also want to use JavaScript to make some of the series clickable.. etc.
As per this gem documentation, this normally is possible:
In practice, I don't seem to be able to make it work.
<div> <%= bar_chart @chart_data, { responsive: true, legend: { position: "right", }, maintainAspectRatio: false, tooltips: { mode: 'label', intersect: true, callbacks: { title: "function(tooltipItem) { return moment(tooltipItem[0].xLabel).format('ll'); }", label: "function(tooltipItem, data) { return data.datasets[tooltipItem.datasetIndex].label + ': ' + tooltipItem.yLabel; }" } }, scales: { xAxes: [{ stacked: true, }], yAxes: [{ stacked: false, userCallback: "function(value, index, values) { value = value.toString(); value = value.split(/(?=(?:...)*$)/); value = value.join(','); return '$' + value; }" }] }} %> </div>
Is this a know bug/issue?
Should I be doing this differently?
Alternatively, is there any way to access the
ctx
andchart
variables from the generated script, so I can eventually attach these callbacks in raw JS, in the case this gem doesn't allow it?Thanks in advance!
The text was updated successfully, but these errors were encountered: