Skip to content

Commit

Permalink
Only consider visible vertical boxes in layout (#8483)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle authored Feb 21, 2021
1 parent 5285735 commit 6f0e795
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/core.layouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,16 @@ export default {
// |----------------------------------------------------|
//

const visibleVerticalBoxCount = verticalBoxes.reduce((total, wrap) =>
wrap.box.options && wrap.box.options.display === false ? total : total + 1, 0);

const params = Object.freeze({
outerWidth: width,
outerHeight: height,
padding,
availableWidth,
availableHeight,
vBoxMaxWidth: availableWidth / 2 / verticalBoxes.length,
vBoxMaxWidth: availableWidth / 2 / visibleVerticalBoxCount,
hBoxMaxHeight: availableHeight / 2
});
const chartArea = Object.assign({
Expand Down
62 changes: 62 additions & 0 deletions test/fixtures/core.layouts/hidden-vertical-boxes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module.exports = {
config: {
type: 'line',
data: {
datasets: [
{data: [10, 5, 0, 25, 78, -10]}
],
labels: ['tick1', 'tick2', 'tick3', 'tick4', 'tick5', '']
},
options: {
plugins: {
legend: false
},
scales: {
x: {
display: false
},
y: {
type: 'linear',
position: 'left',
ticks: {
callback: function(value) {
return value + ' very long unit!';
},
}
},
y1: {
type: 'linear',
position: 'left',
display: false
},
y2: {
type: 'linear',
position: 'left',
display: false
},
y3: {
type: 'linear',
position: 'left',
display: false
},
y4: {
type: 'linear',
position: 'left',
display: false
},
y5: {
type: 'linear',
position: 'left',
display: false
}
}
}
},
options: {
spriteText: true,
canvas: {
height: 256,
width: 256
}
}
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/plugin.legend/title/left-center-center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/plugin.legend/title/left-end-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/plugin.legend/title/right-center-center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/plugin.legend/title/right-end-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/fixtures/plugin.legend/title/right-start-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6f0e795

Please sign in to comment.