Skip to content

Commit 6f0e795

Browse files
authored
Only consider visible vertical boxes in layout (#8483)
1 parent 5285735 commit 6f0e795

File tree

8 files changed

+66
-1
lines changed

8 files changed

+66
-1
lines changed

src/core/core.layouts.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,16 @@ export default {
343343
// |----------------------------------------------------|
344344
//
345345

346+
const visibleVerticalBoxCount = verticalBoxes.reduce((total, wrap) =>
347+
wrap.box.options && wrap.box.options.display === false ? total : total + 1, 0);
348+
346349
const params = Object.freeze({
347350
outerWidth: width,
348351
outerHeight: height,
349352
padding,
350353
availableWidth,
351354
availableHeight,
352-
vBoxMaxWidth: availableWidth / 2 / verticalBoxes.length,
355+
vBoxMaxWidth: availableWidth / 2 / visibleVerticalBoxCount,
353356
hBoxMaxHeight: availableHeight / 2
354357
});
355358
const chartArea = Object.assign({
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
module.exports = {
2+
config: {
3+
type: 'line',
4+
data: {
5+
datasets: [
6+
{data: [10, 5, 0, 25, 78, -10]}
7+
],
8+
labels: ['tick1', 'tick2', 'tick3', 'tick4', 'tick5', '']
9+
},
10+
options: {
11+
plugins: {
12+
legend: false
13+
},
14+
scales: {
15+
x: {
16+
display: false
17+
},
18+
y: {
19+
type: 'linear',
20+
position: 'left',
21+
ticks: {
22+
callback: function(value) {
23+
return value + ' very long unit!';
24+
},
25+
}
26+
},
27+
y1: {
28+
type: 'linear',
29+
position: 'left',
30+
display: false
31+
},
32+
y2: {
33+
type: 'linear',
34+
position: 'left',
35+
display: false
36+
},
37+
y3: {
38+
type: 'linear',
39+
position: 'left',
40+
display: false
41+
},
42+
y4: {
43+
type: 'linear',
44+
position: 'left',
45+
display: false
46+
},
47+
y5: {
48+
type: 'linear',
49+
position: 'left',
50+
display: false
51+
}
52+
}
53+
}
54+
},
55+
options: {
56+
spriteText: true,
57+
canvas: {
58+
height: 256,
59+
width: 256
60+
}
61+
}
62+
};
18.1 KB
Loading
16 Bytes
Loading
14 Bytes
Loading
32 Bytes
Loading
52 Bytes
Loading
65 Bytes
Loading

0 commit comments

Comments
 (0)