apache / echarts

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

[Bug] 通过xAxis.axisTick.interval控制刻度展示和实际展示效果不一致 #20424

Open sunjiesama opened 1 week ago

sunjiesama commented 1 week ago

Version

5.5.0

Link to Minimal Reproduction

https://echarts.apache.org/examples/zh/editor.html?c=line-smooth&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXLANprrJnmxgCeIApkQOQDGAhmPQObABONTADSVyAEw5sixJgFkYQ2EwAqAV3oKmAdXqiNSgBYqmAXREBfYVVRV0tBs3ace_ISPTiwkkkz1qN_40sbEGA8CEgYZgAjYDAwYABbVxtYYAAzNLx6MCIARgAGIKo2XDwAGQhoRgoU9Dx9YAB3IjS2ABsst1gLLpL8MrYo-jaia1q0vgSOTl5mAB1oBaQAN3a1MyYunpS-vCUIFgBrUa66hubqXjUim0qZ1ZHYAAoAfQhBWGWASgQAPhraugWDA8MA2vQAHRtYBcJ7LD5vD7LBDwRDKPxfADcp3IvGyKl4cGRqLRqnU2MB21q4OgXDA-iIAGYAKxbcxkQJkGg4fAnKh2apMB5-MhUrK8CD0QgkERjKgeLzEAAcACZCrAAJyMlUfDX5XK6xkAFk5KQFzDalXUNzqCWAsQZlzU7PQpjMmKAA

Steps to Reproduce

详情请参考最小复现

Current Behavior

第二条刻度线的第一个刻度应该从第二个点开始展示

Expected Behavior

第二条刻度线的第一个刻度从第一个就开始展示了

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

helgasoft commented 1 week ago

yes, looks like a bug somewhere in makeLabelsByNumericCategoryInterval. For a (weird) workaround use return (_i==0 || v=='Tue');.

sunjiesama commented 1 week ago

yes, looks like a bug somewhere in makeLabelsByNumericCategoryInterval. For a (weird) workaround use return (_i==0 || v=='Tue');.

Thank you for your answer. This method has indeed achieved what I wanted, but the first scale is still displayed. I'm thinking about it

helgasoft commented 1 week ago

but the first scale is still displayed

it comes from _i==0 😄 So you either have Mon + Tue ticks, or only Mon... I said it's weird

sz-p commented 4 days ago

Look like a BUG in fixOnBandTicksCoords

Try return 2 tick it will be work

fixOnBandTicksCoords should return null when interval is custom function.

See :

https://echarts.apache.org/examples/zh/editor.html?c=line-smooth&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXLANprrJnmxgCeIApkQOQDGAhmPQObABONTADSVyAEw5sixJgFkYQ2EwAqAV3oKmAdXqiNSgBYqmAXREBfYVVRV0tBs3ace_ISPTiwkkkz1qN23UFFE0sbEGA8CEgYZgAjYDAwYABbVxtYYAAzTLx6MCIARgAGUKo2XDwAGQhoRgp09Dx9YAB3Iky2ABtct1gLXvL8SrZY-k6iawbMvmSOTl5mAB1oZaQANy61MyZe_vTBvCUIFgBrCd7G5rbqXjVSmxr5jfHYAAoAfQggtYBKBAA-eoNdAsGB4YCdegAOk6wC4rzWQU-3wQ8EQyj8PwA3BdyLw8ipeHA1qj0ap1LAAD6U2AktHogJMWA44F7BqQ6BcMD6IgAZgArLtzGRjKEaDh8OcqHY6kxnn4yGzcrwIPRCCQRJMqB4vMQABwAJhKsAAnLyDUETUUCpbeQAWUW9GXMTo1dT3RrJYAJHk3NTC9CmMxYoA