airblade / chartjs-ror

[Not supported - see #53] Simplifies using Chart.js in Rails
MIT License
184 stars 57 forks source link

ticks formatting #47

Open saurabh-bhosale opened 5 years ago

saurabh-bhosale commented 5 years ago

How do i use javascript userCallback for ticks in rails format?

adampope commented 5 years ago

I found that you can pass the callback method as a string and it put into the template as JS that executes

e.g.

<%= line_chart data, {scales: {yAxes: [{ticks: {callback: "function(value, index, values) { return value + '%'; }"}}]}} %>

inyerade commented 4 years ago

@adampope in tooltips callbacks also work. thx