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] ability to set the axis label's width #5702

Closed
ghost opened this issue Aug 23, 2018 · 6 comments
Closed

[FEATURE] ability to set the axis label's width #5702

ghost opened this issue Aug 23, 2018 · 6 comments

Comments

@ghost
Copy link

ghost commented Aug 23, 2018

Feature request.

When having multiple line charts stacked on top of each other, they can't line up if you have varying digits on the Y Axis.

It would be useful if you could set the width of the labels on the Y Axis.

@ghost
Copy link
Author

ghost commented Aug 23, 2018

Work around but not ideal

  scales: {
    yAxes: [{
      afterFit: function(scaleInstance) {
        scaleInstance.width = 100; // sets the width to 100px
      }
    }]
  }
}

@nagix
Copy link
Contributor

nagix commented Jun 3, 2019

Duplicate of #4340

@nagix nagix marked this as a duplicate of #4340 Jun 3, 2019
@nagix nagix closed this as completed Jun 3, 2019
@dbauszus-glx
Copy link

The workaround doesn't seem to work with v3. Is it possible that afterFit callback has been removed?

This prints the instance of the scale with v2.93 but nothing with v3.

  scales: {
    yAxes: [{
      afterFit: instance => console.log(instance)
    }]
  }

@lessless
Copy link

@dbauszus-glx did you find a working solution for v3?

@dbauszus-glx
Copy link

@lessless I have not. Any help is welcome.

@gnoem
Copy link

gnoem commented Oct 8, 2020

@dbauszus-glx this is kind of hacky, but I was able to fix the left axis width by setting the maximum axis width to zero and the left padding for the chart layout to 100:

scales: {
    yAxes: [{
        afterSetDimensions: function(axes) {
            axes.maxWidth = 0;
            console.log(axes.width);
        }
    }]
}
layout: {
    padding: {
        left: 100
    }
}

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

No branches or pull requests

5 participants