How to align Chart.JS line chart labels to the center
12,460
offsetGridLines (boolean) If true, labels are shifted to be between grid lines.
type: 'line',
data: data,
options: {
...
scales: {
xAxes: [{
gridLines: {
offsetGridLines: true
}
]}
}
}
Comments
-
DMEM almost 2 years
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?