chartkick
This is an old revision of the document!
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: [{ ticks: { maxTicksLimit: 5, }, # position: 'top', # Doesn't work } ) end
chartkick.1619269117.txt.gz · Last modified: 2021/04/24 12:58 by slack