apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.14k stars 19.6k forks source link

[Bug] markLine / markArea / markPoint "z" value doesn't follow the value of its parent serie #19108

Open Raphyyy opened 1 year ago

Raphyyy commented 1 year ago

Version

5.4.3

Link to Minimal Reproduction

https://jsfiddle.net/sujatve5/

Steps to Reproduce

https://jsfiddle.net/sujatve5/

Current Behavior

If z value is set to a value greater than 5 on any serie in the chart, markLine will always be hidden by the series

Expected Behavior

markLine should follow the z value of its parent serie to be on top

Environment

- OS: Windows 10
- Browser: Chrome latest
- Framework: -

Any additional comments?

When z has to be defined on multiple series, there is no way to make a markLine to be above of the rest. Either the markLine is defined on a serie with data or in a new serie with a higher z doesn't change anything. I need to set z value on my series as I want my bar series to be bellow my line and scatter series. I also use z to define a specific order with series of the same type.

The thing is that markLine doesn't seems to care about any z. It seems to have a hard defined z of 5 for the line and a z of 6 for its label. In the example, if you set the z of the first bar serie to 4, the markLine and its label goes well in front. But that is not suitable as you can have multiple serie with higher z.

The same goes for markArea or markPoint. Setting a higher zlevel on the serie with markLine doesn't help neither

image

This use case sounds pretty standard. I just want to show a threshold bar above my series.

I came accross every issues opened about this subject and it looks like it has been a problem for a while now (since 2017) : https://github.com/apache/echarts/issues/6690 https://github.com/apache/echarts/issues/9974 https://github.com/apache/echarts/issues/12629 https://github.com/apache/echarts/issues/14190

MatthiasMert commented 1 year ago

Clearly a bug.

For your use case it should be fine if you just not touch the z of the bar series.

Raphyyy commented 1 year ago

Clearly a bug.

For your use case it should be fine if you just not touch the z of the bar series.

Unfortunately I need to use z value for other stuff, like disabling emphasis state on chart hovering (https://github.com/apache/echarts/issues/14952#issuecomment-842730046). I also want my Threshold to appears on top of my line and scatter series, not only bars, and I have charts with plenty of series.

helgasoft commented 1 year ago

The default z for MarkLine is 5 (see source) and is probably not incremented with its parent's z-value.

want my Threshold to appears on top of my line and scatter series

One workaround to this bug is to use fractional z values for main series - Demo Code. This allows for hundreds of z-planes to work with between the defaults z:0 and z:5. image

Raphyyy commented 12 months ago

Thanks for the workaround @helgasoft Unfortunately for me it's still not a good solution as I also have some charts with markArea and I need it to stay in the background. You can see in the following image that the line and the bar serie stay behind the markArea.

image

I guess I'll just make z value start incrementing from 5 if I have a markArea serie, as the threshold bar will not likely to be displayed at the same time (our users can fully customize their charts).

clark-tan commented 11 months ago

1.When markLine and markPoint are set on a line at the same time, the hierarchy of the two cannot be modified through z, and the z of markPoint is always greater than the z of markLine.

2.markLine and markPoint are set respectively for two different lines. After the zlevel of the two lines is changed, the z of markPoint is always greater than the z of markLine.