Skip to content
New issue

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

[Bug] xAxis "1" not found #19928

Closed
rr210 opened this issue May 13, 2024 · 1 comment
Closed

[Bug] xAxis "1" not found #19928

rr210 opened this issue May 13, 2024 · 1 comment
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature.

Comments

@rr210
Copy link

rr210 commented May 13, 2024

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

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@rr210 rr210 added the bug label May 13, 2024
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels May 13, 2024
@helgasoft
Copy link

maybe this code will help
📌 please close issue if problem solved.

@rr210 rr210 closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug en This issue is in English pending We are not sure about whether this is a bug/new feature.
Projects
None yet
Development

No branches or pull requests

2 participants