I'm using Chart.JS 1.0.2 to create a line chart:
What I'm trying to do is move the labels that are on the bottom of the chart the center of each rectangle (instead of being aligned with the vertical grid lines):
There is no documentation about this on chartjs.org but I believe that with a smart trick this problem can be easily solved. Any ideas on how this can be accomplished?
offsetGridLines (boolean) If true, labels are shifted to be between grid lines.
type: 'line',
data: data,
options: {
...
scales: {
xAxes: [{
gridLines: {
offsetGridLines: true
}
]}
}
}
Test this:
labelOffset:-5 //adjust number
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With