Skip to content

No padding between rotated x-axis labels #2750

Description

@airblade

Hello! I'm using Chart.js v2.1.4. Thank you for the great code :)

I have a bar chart that looks like this:

screen shot 2016-06-10 at 11 29 29 am

The x-axis labels are hard to read because there is just about no padding between them.

Here is the same chart produced by Chart.js v1.0.2:

screen shot 2016-06-10 at 11 31 06 am

The labels are easier to read because they are rotated more to give more padding.

Is the v2.1.4 behaviour expected? How can I have the labels rotated more so they are easier to read?

I tried adding 15° rotation to the labels like this:

var options = {
    scales: {
        xAxes: [{
            afterCalculateTickRotation: function(scale) { scale.labelRotation += 15; };
        }],
    }
};

This worked but of course it always adds extra rotation so it looks silly on a chart with only a few bars where the labels don't need to be rotated at all.

Many thanks!

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions