apache / echarts

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

Using sampling with connectNulls connects regular datapoints with null ones when zoomed out #14689

Closed tmscer closed 2 years ago

tmscer commented 3 years ago

Version

5.1.0

Reproduction link

~https://codepen.io/tmscer/pen/wvgxKNR~ https://codepen.io/tmscer/pen/yLgGXbo

Steps to reproduce

Use a series line with connectNulls: false and sampling: 'lttb' (may be reproducible with other sampling methods) and have a null value in your data.

What is expected?

I'd expect null values to never be connected with regular values.

What is actually happening?

When zoomed out, regular values are connected with null values. When zoomed in, the line between regular values and nulls disappears and behaves as expected.


I suspect this may be caused by the sampling algorithm since when no sampling is used, null values are never connected with regular ones.

I'm not sure what version of Echarts is used in the codepen, however, the bug is reproducible in 5.1.0. To see the bug, zoom in the flat line. At the end of it, there is a null.

echarts-bot[bot] commented 3 years ago

Hi! We've received your issue and please be patient to get responded. 🎉 The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical question.

If you are interested in the project, you may also subscribe our mailing list.

Have a nice day! 🍵

tmscer commented 3 years ago

Images

When zoomed out

2021-04-16_20-45-59

When zoomed in

2021-04-16_20-46-07

echarts-bot[bot] commented 3 years ago

@tmscer Please simplify your demo to help us debug.

A minimum reproducible demo should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.

tmscer commented 3 years ago

I've simplified the demo. I removed as much as possible, however, some data (~1600 datapoints) is left in the demo to actually see the bug. See https://codepen.io/tmscer/pen/yLgGXbo.

There is a null value on line 634 with which other datapoints shouldn't be connected. I suspect sampling may play a role since once removed, the null value is no longer connected. Zooming, as per issue's first comment, disconnects the null datapoint.

Let me know if the demo is simple enough. But I am afraid that further significant simplification isn't possible.

Ovilia commented 3 years ago

@tmscer Thanks. I think we can get on it based on this.

OrestHk commented 3 years ago

Hi ! First of all thx for the library, started using it this week ! It's just awesome ! Easy to use, with customization and performance !

I'm having a similar issue in my project https://codepen.io/test45/pen/RwKEBqN. Here's another sample if it can help ! With a bit more holes (null values) The unwanted behaviour can be seen zooming a bit in the chart and moving the x absis

As for Tmscer example, the problem seems only to appear when using LTTB sampling method, and when the algorithm is applied to the serie. When the zoom level allow to display all points on the chart, the problem disappear. Guess it as something to do with the algorithm handling null / undefined values in the serie.

Sorry if the english is a bit messy ! And thanks again for your work !

tmscer commented 3 years ago

I see that 5.2.0 has been released, should the milestone be updated or is it possible that this bug will be fixed in some 5.2.x?

tmscer commented 3 years ago

@Ovilia.

chenlijun99 commented 2 years ago

I reported the same issue in #13228

sglvladi commented 2 years ago

Hi there! Any updates on this?

pissang commented 2 years ago

Seems it's because the null values are filtered during sampling

tmscer commented 2 years ago

Seems it's because the null values are filtered during sampling

An idea: a null value should then split the dataseries into separate chunks that can be then sampled separately.