apache / echarts

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

fix(Axis): xAxis axisTick custom interval funciton work error with boundaryGap false #20436

Open sz-p opened 1 month ago

sz-p commented 1 month ago

Brief Information

This pull request is in the type of:

What does this PR do?

Fixed issues

20424

Details

Before: What was the problem?

image

After: How does it behave after the fixing?

image

Document Info

One of the following should be checked.

Misc

ZRender Changes

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

Other information

echarts-bot[bot] commented 1 month ago

Thanks for your contribution! The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

github-actions[bot] commented 1 month ago

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-20436@2625230

sz-p commented 1 month ago

Thank you for reviewing!

I see the problem. and i found a new problem.

If every one tick in intervalList is true. the last one will be out of control.

image

The new fix way is change tick to right position and add last one after intervalList.

See the result after fix.

image

Ovilia commented 1 month ago

Thanks for the detailed test!

Can you explain why there is a tick before Thu when the last is false in the last two charts?

What's the current policy for the last tick to show?

sz-p commented 1 month ago

The current logic is simple: add last one after intervalList.

To form a tick pair, similar to the effect of boundaryGap: true, add an ending tick to the intervalList.

A potential issue arises if the intervalList is [true, false]. By adding an end tick, it becomes [true, true], which might seem odd.

A more intelligent way is if the tick is end of axis then add it. if not ignore it.

Should we use this?

Ovilia commented 4 weeks ago

I don't think axis ticks work in pairs, so I'd think add last one after intervalList works pretty intuitive to me.

sz-p commented 4 weeks ago

See new reault.

image

sz-p commented 3 weeks ago

See new reault.

image