chartkick
The library hash gets passed through Chartkick to chart.js.
For some reason axes need to be labelled xAxes (can be(?) an array for multiple x axes) rather than just x as in the chart.js docs.
def model_helper(data) line_chart( data, title: 'Chart title', ## Axes min: 10, # default 0 if no non-zero points max: 100, xtitle: 'Time', ytitle: 'Lolz', ## CSS id: 'lolchart', ## Appearance height: '500px', colors: COLORS, points: false, # Key legend: :bottom, ## No idea why these have to be in a hash: library: { spanGaps: true, lineTension: 0.5, # Values between 0 and 1-ish seem to do something curve: true, # false = straight line segments scales: { xAxes: [{ display: false, ticks: { maxTicksLimit: 5, }, # Can't get anything else to work here } } } ) end
chartkick.txt · Last modified: 2021/04/24 13:12 by slack