Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] option to center line labels and points between grid lines on the x axis like in bar charts #4051

Closed
cizmiak opened this issue Mar 21, 2017 · 3 comments · Fixed by #4545

Comments

@cizmiak
Copy link
Contributor

cizmiak commented Mar 21, 2017

Expected Behavior

There should be new property in line dataset or grid lines configuration. And when it is set, line points and x labels should be centered between x grid lines and x ticks (as they are drawn in mixed chart with same line configuration and bar configuration).
image

Current Behavior

For line charts line points, x grid lines, x ticks and x labels are vertically centered.

Possible Solution

Possible workarounds:
http://stackoverflow.com/questions/39700096/how-to-add-an-offset-to-a-dataset-in-chart-js
http://stackoverflow.com/questions/37970461/chart-js-line-charts-draw-points-between-grid-lines

Context

We are creating charts and mixed type charts based on user configuration and would like to achieve consistent look.

Environment

  • Chart.js version: 2.5
@etimberg
Copy link
Member

@cizmiak have you tried

axisOptions: {
  gridLines: {
    offsetGridLines: true
  }
}

The setting is normally used for bar charts, but it might work here

@cizmiak
Copy link
Contributor Author

cizmiak commented Mar 21, 2017

@etimberg, thank you. I'm sorry, but it seems that setting this option doesn't work as expected. Points of a line are still drawn at intersects of grid lines: https://jsfiddle.net/24aotbnc/12/

@etimberg
Copy link
Member

That's what I was hoping wouldn't happen. Tagging as an enhancement for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants