apache / echarts

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

How to set axisPointer snap to both X-axis and Y-axis? 如何让axisPointer同时吸附X轴和Y轴? #9504

Closed fakedestinyck closed 3 years ago

fakedestinyck commented 5 years ago

General Questions

PLEASE MAKE SURE OF ALL THE FOLLOWING OPTIONS IN REQUIRED FIELDS ARE TICKED (with x)! Otherwise, the issue will not be answered. And think before you tick. :) 请确保以下每项都打上勾了!并且确保都做了这些事哦~ 这将大量简化我们的工作流程,使你的问题更快速得到解答。

In this issue, I have provided information with: 在这个 issue 中我提供了以下信息:

Issue Type

Issue Details

How to set axisPointer snap to both X-axis and Y-axis?

Currently, I set yAxis.minInterval = 1. When I attempt to move my mouse inside the graph, can I force the Y-axis line (horizontal line) of the axisPointer to move discretely from 1 to 2, 2 to 3, etc., rather than continuously from 1 to 2 (i.e. 1.00 1.01 1.02 ... 1.99 2)?

如何让axisPointer同时吸附X轴和Y轴? 比如我设了y轴的最小刻度为1,我能不能让axisPointer的那根y轴的线不要连续移动,而是只会比如 1 2 3的这样移动?

Expected Behavior

axisPointer snap to both X-axis and Y-axis.

axisPointer同时吸附X轴和Y轴。

Current Behavior

axisPointer only snaps to X-Axis.

axisPointer只吸附在X轴上。

Online Example

tooltip: {
    trigger: 'axis',
    axisPointer: {
        type: 'cross',
        label: {
            backgroundColor: '#6a7985'
        },
        snap: true
    }
},

Topics

Anything Else We Need to Know

N/A

Environment

cuijian-dexter commented 5 years ago

http://www.echartsjs.com/gallery/editor.html?c=doc-example/candlestick-axisPointer

fakedestinyck commented 5 years ago

http://www.echartsjs.com/gallery/editor.html?c=doc-example/candlestick-axisPointer

@cuijian-dexter 不是 可能我没表达清楚 我的意思是 比如我设了y轴的最小刻度为1,我能不能让axisPointer的那根y轴的线不要连续移动,而是只会比如 1 2 3的这样移动

100pah commented 5 years ago

Currently, in an axis whose type is 'value', the axisPointer can only snap to data point, rather than axis tick.

Could I know why do you intend to make axisPointer snap to axis tick (e.g., 1, 2, 3)? If the scenario is reasonable, it can be added as a new feature ~

fakedestinyck commented 5 years ago

Currently, in an axis whose type is 'value', the axisPointer can only snap to data point, rather than axis tick.

Could I know why do you intend to make axisPointer snap to axis tick (e.g., 1, 2, 3)? If the scenario is reasonable, it can be added as a new feature ~

I'm making a ranking chart. And since the ranking could only be an integer, there's no reason that the y-axis label of the axisPointer would be a floating number rather than an integer. That is what I am thinking. @100pah

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 3 years ago

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!