Conversation
|
Thanks for the reviews @benmccann! I did another round around this, largely based on your comments. I also combined some functions, although CC now complains about them. But I don't think splitting to more functions makes it really simpler. |
src/core/core.layouts.js
Outdated
| var chartAreaWidth = chartArea.w / 2; // min 50% | ||
|
|
||
| // Steps 2-3 | ||
| var params = { |
There was a problem hiding this comment.
I think that chartArea is mutated while the rest are read-only constants. What if we take chartArea out of this and pass it separately and then call Object.freeze on params. I think that would help a lot in keeping track of which variables change between function calls.
I also wonder if we need to keep track of chartArea. It seems like there's a lot of complexity in keeping outerDims and chartArea in sync with each other and the boxes at all times. But isn't chartArea.w just outerWidth - outerDims.left - outerDims.right? I think it'd be massively simpler if we just had to worry about keeping outerDims updated. I think we do a pretty good job keeping outerDims.left updated, but there might be a couple places where we skip updating outerDims.right and so we'd have to check that we always keep it updated in order to make that work
There was a problem hiding this comment.
@kurkle I think this is the only comment I had that hasn't been addressed yet. I resolved the rest.
I'd like if we could at least add a comment saying that w and h are the only mutable properties and the rest are read-only or possibly we could go further as I mentioned above
Besides that, this PR looks good to me. Thank you so much for all the work on this. I'm very excited about it!
There was a problem hiding this comment.
I'll take another look at this later, because I feel you are right and this part can be simplified.
|
@benmccann comments made me realize this can be done with a round less of updates. |
This comment has been minimized.
This comment has been minimized.
|
Noticed that |
benmccann
left a comment
There was a problem hiding this comment.
looks pretty good to me. I'm quite excited about this! just a few minor comments (in addition to a few from the last round that haven't been responded to)
|
When the x axis is a category scale, and the legend is on the left, the second tick label sometimes disappears. {
type: 'line',
data: {
labels: ['ABCDEFG', 'ABCDEFG'],
datasets: [{
data: [0, 1]
}]
},
options: {
responsive: false,
legend: {
display: true,
position: 'left'
}
}
} |
|
Thanks @nagix for testing! Fixed, I think quite a lot of tests should still be written to complete these changes. |
|
Maybe the first and second |
|
Update (fixes wrong padding of legend): removed the If I these changes broke something, then we are missing tests 😄 |
|
Thanks again, @nagix! Broke that in previous commit. Fixed now. |
|
There's one currently failing test |
|
@kurkle Thank you for the fix. One concern about getting rid of I also feel that the name |









Inspired by #6300, took another look at layouts.
Small changes hidden in a huge refactor :)
minRotationinstead ofmaxRotationin_getLabelSizefor vertical time scale.maxRotationdefaults to 50, but vertical axis ticks are only rotated tominRotation.This might be a bit faster than master, due to using
forinstead ofhelpers.eachand caching stuff to a "layout box" container.CodePen
Closes: #6300