We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
5.5.0
无
const xAxis = [ '星期一', '星期二', '星期三', '星期五', '星期六', '星期天' ]; const bar1 = [10, 2, 0, 4, 5, 6, 7]; const bar2 = [8, 9, 10, 11, 12, 13, 14]; const bar3 = [0, 0, 17, 18, 19, 20, 21];
function dealBar(arr, name) { const bar = []; arr.forEach((item, index) => { const data = []; for (let i = 0; i < index; i++) { data.push(''); } if (item) { data.push(item); bar.push({ name, type: 'bar', xAxisIndex: index, barWidth: 20, data }); } }); return bar; } option = { legend:{}, xAxis: xAxis.map((item, index) => { const data = Array(xAxis.length).fill(''); data[index] = item; return { type: 'category', position: 'bottom', data: data }; }), yAxis: { type: 'value' }, series: [ ...dealBar(bar1, 'bar1'), ...dealBar(bar2, 'bar2'), ...dealBar(bar3, 'bar3') ] };
[Bug] xAxis "1" not found
分组过滤为0的 不占位
- OS: - Browser: - Framework:
No response
The text was updated successfully, but these errors were encountered:
maybe this code will help 📌 please close issue if problem solved.
Sorry, something went wrong.
No branches or pull requests
Version
5.5.0
Link to Minimal Reproduction
无
Steps to Reproduce
const xAxis = [
'星期一',
'星期二',
'星期三',
'星期五',
'星期六',
'星期天'
];
const bar1 = [10, 2, 0, 4, 5, 6, 7];
const bar2 = [8, 9, 10, 11, 12, 13, 14];
const bar3 = [0, 0, 17, 18, 19, 20, 21];
function dealBar(arr, name) {
const bar = [];
arr.forEach((item, index) => {
const data = [];
for (let i = 0; i < index; i++) {
data.push('');
}
if (item) {
data.push(item);
bar.push({
name,
type: 'bar',
xAxisIndex: index,
barWidth: 20,
data
});
}
});
return bar;
}
option = {
legend:{},
xAxis: xAxis.map((item, index) => {
const data = Array(xAxis.length).fill('');
data[index] = item;
return {
type: 'category',
position: 'bottom',
data: data
};
}),
yAxis: {
type: 'value'
},
series: [
...dealBar(bar1, 'bar1'),
...dealBar(bar2, 'bar2'),
...dealBar(bar3, 'bar3')
]
};
Current Behavior
[Bug] xAxis "1" not found
Expected Behavior
分组过滤为0的 不占位
Environment
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: