apache / echarts

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

[Bug] Gaps in line despite data being present #19254

Open hamza-ae opened 12 months ago

hamza-ae commented 12 months ago

Version

5.4.3

Link to Minimal Reproduction

https://codesandbox.io/s/basic-line-chart-forked-kxw3cm?file=/index.js

Steps to Reproduce

By hovering over the gap areas, the tooltip shows there is data there (mostly 0 values though they should still be displayed on the line). You can also see there is data values present in the data const itself.

Current Behavior

chrome-capture-2023-10-29 (1)

Expected Behavior

There should not be gaps where data is present

Environment

- OS: macOS Sonoma
- Browser: Chrome Version 118.0.5993.117 arm64

Any additional comments?

No response

helgasoft commented 12 months ago

not-a-bug Yes, it's hard to look at a 44K points chart without dataZoom. But improvements can be made:

const data = ... 44K points with plenty of 0 and null...
const data2 = data.filter((item) => item.y && item.y!=0);
option = {
  tooltip: { 
    formatter: (p) => {return p.data.x+' '+p.data.y;},
    trigger: 'item' //'axis'
  },
  dataset: {source: data2},
  xAxis: {},
  yAxis: {},
  series: [
    {
      type: 'line',
      encode:{x:'x', y:'y'},
      symbolSize: 2
    }
  ],
  dataZoom: [{type: 'slider', filterMode: 'none', xAxisIndex: 0}]
};

image

hamza-ae commented 12 months ago

Thanks but that's not quite the graph I'm looking for. Only 4% of the dataset is null values, I also noticed that when I browser zoom out, the graph starts looking more as expected, correctly with only a few gaps where the values are actually null: fixed

(Browser zoom out at start and then pinched zoomed in with trackpad)

hamza-ae commented 4 weeks ago

@Ovilia @helgasoft Sorry to bother but could you have a look at my response above, I do think it is a bug considering the line can look correct by adjusting the browser zoom. Please let me know if I have missed something but in my mind the large gaps in the line should not be present when only 4% of the dataset is null values.

Thank you!