User Tools

Site Tools


chartkick

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
chartkick [2021/04/24 12:17] – created slackchartkick [2021/04/24 13:12] (current) slack
Line 1: Line 1:
 +[[https://gist.github.com/repent/c95338c1dedca4b728381856b695c9df|Some rando's options]].
 +
 +The ''library'' hash gets [[https://stackoverflow.com/questions/57719975/force-display-of-ticks-on-xaxes-using-chartkick-gem-and-chart-js|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 [[https://www.chartjs.org/docs/latest/axes/cartesian/|in the chart.js docs]].
 +
 <code ruby> <code ruby>
 def model_helper(data) def model_helper(data)
Line 26: Line 32:
       lineTension: 0.5, # Values between 0 and 1-ish seem to do something       lineTension: 0.5, # Values between 0 and 1-ish seem to do something
       curve: true, # false = straight line segments       curve: true, # false = straight line segments
 +      scales: {
 +        xAxes: [{
 +          display: false,
 +          ticks: {
 +            maxTicksLimit: 5,
 +          },
 +          # Can't get anything else to work here
 +        }
 +      }
     }     }
   )   )
 end end
 </code> </code>
chartkick.1619266633.txt.gz · Last modified: 2021/04/24 12:17 by slack