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.

[BUG] labelOffset not working for vertical axis

See original GitHub issue

Expected 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

  1. Adjust documentation, that it’s the offset in axis direction.
  2. Add optionTicks.labelOffset to labelY in core.scale.js’s draw-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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dekuenstlecommented, Jul 7, 2017

@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. 👍

0reactions
MathiasHCcommented, Jul 7, 2017

@dekuenstle You can acquire the same result as labelOffset with some padding, tickMarkLength and ticks.mirror = true.

  • It’s most diffidently not the same, but it gets you a little bit of the way, until the 2.7.0 release - which hopefully fixes a couple of things 💪

And yes, I agree with you on everything you have said - could be nice with the (x,y) offset options.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When horitzontal ticks are rotated 90 degrees, the tick labels ...
I tried various combinatinos of align and crossAlign, it just doesn't move the vertical alignment of the label to the axis.
Read more >
Re: Annotation Label Offset Explanation - Page 4 - NI Community
We use waveform graphs with an absolute time axis (e.g. X-axis min ... The problems only seem to occur when the xscale multiplier...
Read more >
matplotlib remove axis label offset by default - Stack Overflow
In 2013 a boolean matplotlibrc parameter called axes.formatter.useoffset was added, which can switch off the offset. ... No, there is no way to...
Read more >
TGaxis Class Reference - ROOT
One can make a vertical axis going top->bottom. ... To draw only the axis tick marks without the axis body, it is enough...
Read more >
TGaxis Class Reference - ROOT
//problem, the two x values should not be equal ... To draw only the axis tick marks without the axis body, it is...
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