-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Multiple y axes don't honor scaleLabel of inner axis #4505
Comments
@etimberg #4382 doesn't seem to apply to axis labels.
I was on the wrong track due to the linked PR. It still feels hacky though: chartjs already manages placement of cartesian axes and axis labels. Shouldn't it also take both into account? Seems this is not |
I think where this needs to go is here https://github.com/chartjs/Chart.js/blob/master/src/core/core.scale.js#L334 plus where the label is actually drawn. In case of a vertical axis the min width is already size of scale label * 1.5. If not an "outer" axis this should become scale label * 2 and the label needs be drawn in different position. Any hints how to find out what type of axis we are (and where to limit this to cartesian axes)? |
That's my error on the PR. For some reason I thought it was that one. I think the best way to handle this would be to have a Doing this automatically only for certain axes will be tricky. At the moment, the axes do not know about their siblings so something would likely need to be added at the chart level which complicates it. The label is drawn in https://github.com/chartjs/Chart.js/blob/master/src/core/core.scale.js#L734-L760 |
I don't think so. The scale is already handling correct positioning of the label, that is applying 0.5 lineHeight of padding between label and axis. Whats missing is nother 0.5 lineHeight padding to the next axis:
|
My concern with adding that logic is that it wouldn't solve requests for configurable size but more that it is much more involved to fix it. The axes don't know about the other axes and so that would mean adding something to the layout system to give them extra information. I feel like that would be giving the layout system too much responsibility over other things that are not directly related to where all the boxes are in the chart. It would also mean that settings on other axes could affect the rendering of a different axis and that would lead to complicated tests |
I see where you're coming from.
That would work. Since I'm already creating the axis depending on selected series I could also conditionally apply the padding. |
With multiple y axes, the outer axis touches the inner axis's scale label if present. Either inner axis's scale label needs additional outside space if the axis not outermost as well or every non-inner axis needs additional space if previous inner axis has scale label.
The text was updated successfully, but these errors were encountered: