question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong position ticks in time scale with offsetGridLines

See original GitHub issue

Hi,

I’m using chartjs latest version (2.7.2).

I’m using offsetGridLines: true to center my xAxes label (2016, 2017,…), but since i use this options, my points are not in the right position.

For example, this point need to be between the red lines (because it belongs to 2016)

Image of Yaktocat

jsfidle: https://jsfiddle.net/mrbmvd19/1/ (look at the 2016-12-01)

Do you know how to do that?

Thanks a lot.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
etimbergcommented, May 15, 2018

@alexandre-tobia offsetGridLines also centers the values, so 2017 starts at the 2017 label.

@simonbrunel thoughts on a way to improve this?

0reactions
kurklecommented, Mar 25, 2021

Does not look like an issue in v3 anymore?: https://jsfiddle.net/n5dbt2ue/ Could be actually fixed in 2.9 already, did not test.

Edit: nevermind image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Chart.js : How I change the x axes ticks labels alignment in ...
The option you're looking for is offsetGridLines . If true , grid lines will be shifted to be between labels. xAxes: [{ ....
Read more >
Change the scale of the horizontal (category) axis in a chart
Placement of tick marks. Point where the horizontal axis crosses the vertical axis. To change the scale of other axes in a chart,...
Read more >
Bar Chart | Chart.js
The grid line will move to the left by one half of the tick interval. If false, the grid line will go right...
Read more >
[Solved]-Handle X-axis label position in chart js-Chart.js
It is certainly possible to achieve a 'right' aligned scale tick label instead ... { display : false, offsetGridLines: true }, ticks: {...
Read more >
Python Figure Reference: layout.xaxis - Plotly
If set to "free", this axis' position is determined by `position`. automargin ... If `range` is provided, then `autorange` is set to "False"....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found