Y-axis label of a bar chart disappears if `realtimeSort` is true and there is just one pair of key-value format source in `dataset`
- Dominant language
- TypeScript
- Stars
- 67.3k
- Forks
- 19.8k
- Avg merge
- 11d 14h
- Merged PRs (30d)
- 8
Description
### Version
5.1.1
### Reproduction link
[https://codepen.io/zaakn/pen/KKWZPVm](https://codepen.io/zaakn/pen/KKWZPVm)
show the code just same with the codepen above
```javascript
var mychart = echarts.init(document.getElementById('mychart'));
var sources = {
bar: [{key: "BarKey1", value: 30}],
// if the foo array has been sorted [10, 20], the y-axis label issue will occur.
fooSorted: [{key: "FooKey1", value: 10}, {key: "FooKey2", value: 20}],
// if [20, 10], not occur
fooUnsorted: [{key: "FooKey2", value: 20}, {key: "FooKey1", value: 10}]
}
var option = {
dataset: { source: sources["fooSorted"] },
xAxis: { type: "value" },
yAxis: { type: "category"},
series: [
{ type: "bar", realtimeSort: true }
]
}
document.getElementById("switch").addEventListener("click", function(ev) {
const { dataset: ds } = option;
const { checked } = document.getElementById("sorted");
const wantedKey = !!checked ? "fooSorted" : "fooUnsorted";
ds.source = ds.source == sources[wantedKey] ? sources["bar"] : sources[wantedKey];
mychart.setOption(option);
})
mychart.setOption(option);
```
```html
Click Me
sorted data
```
### Steps to reproduce
1. `realtimeSort` is `true` in a bar `series`
2. use the key-value format data in `dataset`, like:
```json
[
{key: "FooKey1", value: 10},
{key: "FooKey2", value: 20}
]
```
3. the source data array is sorted. (ascending, whatever `yAxis.inverse` is)
4. set `realtimeSort` in `series` instead of `yAxis`, [ref from official example](https://echarts.apache.org/examples/en/editor.html?c=bar-race)
5. the issue will occur only when the dataset source has been changed.
### What is expected?
the y-axis label is shown.
### What is actually happening?
the y-axis label is hidden.
---
Contributor guide
Assessment
This issue has not been assessed yet.