Describe the bug
I am building an icicle chart, with 4 to 5 levels (columns), from left to right. The labels on the first 3 columns are much shorter (all <30 characters) than the labels on the 4th and 5th column (can be > 100 characters). I would like to adjust the width of these columns, by setting the first 3 column to have much less width than the 4th and 5th column.
Setting the width using a function in the .size()
parameter does not seem to work as I expected. It changes the height of the cell in LR orientation, and not the width.
To Reproduce
Steps to reproduce the behavior:
- For ease, create a 3 (no need 5) column icicle chart. You can use my data sample
let data = {
"name": "root",
"children": [
{
"name": "First Col",
"children": [
{
"name": "Second Col",
"children": [
{"name": "Third Col 1", "value": 1},
{"name": "Third Col 2", "value": 1},
{"name": "Third Col 3", "value": 1}
]
}
]
}
]
}
- In the JavaScript script, put size parameter, a function that returns value according to which column it is, for example
Icicle()
.data(data)
.size(d => {
if (d.name.substring(0,5) == 'First') {
return 10
} else if (d.name.substring(0, 5) == 'Secon') {
return 10
} else {
return 300
}
})
(document.getElementById('myDiv'));
Expected behavior
The width of the first and second column should be much less than the third column.
Screenshots
However, instead of changing the width, the height change.
This is the sizes without setting the .size()
parameter
This is the sizes after setting the .size()
parameter
Desktop (please complete the following information):
- OS: macOS
- Browser: Safari, Chrome
Your help will be very appreciated! :)