Skip to content

[BUG] labelOffset not working for vertical axis #3889

Description

@dekuenstle

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions