apache / apache/echarts

[Bug] ECharts splitLine not showing on interval function

Open
#19,247 5 comments 0 reactions 1 assignee Claimed by @Ovilia View on GitHub
bug en topic: axis
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.4.3

### Link to Minimal Reproduction

https://codepen.io/calabasssita/pen/wvNaJrd

### Steps to Reproduce

You can reproduce it also [on the examples editor:](https://echarts.apache.org/examples/en/editor.html?c=line-simple&theme=dark&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6IYHgiQYdMKF79YAE2aMiAbVq9YtAEabVKnmu2MD22gF0-pWHhAAbEQBkI0GsXPo8AC2AB3ImA4BXKjMXBxYOADdGKyIAMz9oelFoAAoHGSoMXQirAIBKZxd0DiowPw44LIDYAEJEFQBuaXQAX2kW5qC5MEYALWBgAFslaVQCimo6PBs0jlpWoPQRlzGnWgdhNNnzNthTEnIcfCJF9GW6CqpN2CagvCoOCCpCWEVhxtl5JQBGAFYABl0AEwAZn-sABAIALLpPhCAOyAgBsoL-u1GlBWNkcl2aJGMKCadSAA)
There are splitLines under each data label when it's not an empty string:
```
option = {
xAxis: {
type: 'category',
position: 'top',
data: ['', 'bbb', '', '', 'aaa', ''],
splitLine: {
show: true,
interval: function(index, value) {
return value != '';
}
}
},
dataZoom: [
{
type: 'slider'
}
],
yAxis: {
type: 'value'
},
series: [
{
data: [150, 230, 224, 147, 260, 50],
type: 'line'
}
]
};
```

Change data do this, for example, the splitLine goes to the left side of the chart, and not under the data label:

```
data: ['', '', '', '', 'aaa', ''],
```

It also happens if you have data like this, and you zoom leaving only one label on the zoomed data

```
data: ['', 'bbb', '', '', 'aaa', ''],
```

### Current Behavior

The splitLines does not show under the label when there's only one not empty value in data, it also happens while having more than one not empty values if you zoom the chart so only one one not empty value is shown.

### Expected Behavior

To have a splitLine under the data label when it satisfies the function.

### Environment

```markdown
- OS:macOs Ventura 13.4
- Browser: Firefox version 118.0.2 (64-bit)
- Framework:
```

### Any additional comments?

If there's a workaround, to only show the splitLines when a value is different from X it would also help, Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.