Chart.js: [Question] Line chart : label position when there is only one data

Created on 27 Jul 2016  Â·  3Comments  Â·  Source: chartjs/Chart.js

Hi,

When there is only one data on a line chart, points and label are sticked on the y axe
https://jsfiddle.net/rn1pocs5/3/

Is it possible to center points + label in this case ?

I can get this result with a trick (use bar chart, add an "hidden" dataset and override type of the others) but it's a bit dirty
https://jsfiddle.net/h27rL8qq/1/

help wanted enhancement

Most helpful comment

Please, add
xAxes: [{
gridLines: {
offsetGridLines: true
}
}]
for the desired result (it controls label offset)

All 3 comments

I think we can find a way to support this better

I still see an issue where my axis tick label is stuck to the left but the data point is centered. This makes things look weird

Please, add
xAxes: [{
gridLines: {
offsetGridLines: true
}
}]
for the desired result (it controls label offset)

Was this page helpful?
0 / 5 - 0 ratings