[BUG] labelOffset not working for vertical axis
See original GitHub issueExpected Behavior
In the docs labelOffset
is described as:
Distance in pixels to offset the label from the centre point of the tick (in the y direction for the x axis, and the x direction for the y axis). Note: this can cause labels at the edges to be cropped by the edge of the canvas
From the docs, I expect the label to move left/right if I set a non-zero value for labelOffset of a vertical axis, and up-down for a horizontal axis.
Just from the variable name I would expect opposite behaviour:
in the y direction (up/down) for the y axis, and the x direction (right/left) for the x axis
Current Behavior
Label is moving left/right on horizontal axis and not at all on a vertical axis.
Possible Solution
- Adjust documentation, that it’s the offset in axis direction.
- Add
optionTicks.labelOffset
tolabelY
in core.scale.js’sdraw
-method.
Steps to Reproduce (for bugs)
See http://codepen.io/anon/pen/JEmaBY
Context
We tried to to accomplish labels between the tick lines in a bubble chart. The labels of the vertical axis were rotated by 90° (text parallel to y-axis)
Environment
- Chart.js version: v2.5.0
- Browser name and version: Chromium 56
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
@MathiasHC Thank you! We currently worked around the issue with similar configs and some whitespace 😉 It works for now, but i really appreciate the propper fix for 2.7. 👍
@dekuenstle You can acquire the same result as labelOffset with some padding, tickMarkLength and ticks.mirror = true.
And yes, I agree with you on everything you have said - could be nice with the (x,y) offset options.