You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by Wenli Zhang <ov...@gmail.com> on 2018/10/25 05:07:26 UTC

[Feature Request] axisPointer position snap to data

Hi dear developers,

Here we'd like to discuss about
https://github.com/apache/incubator-echarts/issues/7651 . Since the issues
is in Chinese, here I'm going to describe it in English.

[image: axisPointer position.png]

Basically, it is required in the issue that the cross point of the
axisPoint always snap to data point. In this case, the x position of the
cross point is decided by mouse position, and the y position by the data of
the corresponding x position.

But currently, ECharts doesn't provide a method for the y position to be at
data position. I'm not sure if *snap* is the correct word since currently
the snap option in axisPoint seems to mean to be near to the data but not
compulsively.

Expected: https://gupiao.baidu.com/stock/sh000001.html?from=aladingpc
Current ECharts: http://gallery.echartsjs.com/editor.html?c=x8K2BwAFx5&v=2

We'd like to discuss in this email:
1. Should we implement the feature as the *Expected* example shows?
2. Should this be called *snap* or something else?
3. Should we provide an option or make this default?
4. Is there anything we should be aware of when implementing this? @100pah

Zhang Wenli
http://zhangwenli.com

Re: [Feature Request] axisPointer position snap to data

Posted by SHUANG SU <su...@gmail.com>.
This is another existing example relative to this issue:
https://ecomfe.github.io/echarts-examples/public/editor.html?c=scatter-nutrients-matrix

I agree that this feature is important.
I think some other `option` can be added to this feature, but might not be
by default.
There have been an option "snap":
https://ecomfe.github.io/echarts-doc/public/en/option.html#yAxis.axisPointer.snap
,
but the value can only be `true` or `fale`.
Should we extend the optional value? for example:

EC option case 1:
tootip: {
    axisPointer: {
        snap: true / false  // do not change, can not enable this feature
here.
    }
}

EC option case 2:
xAxis: {
    axisPointer: {
          snap: true
    }
},
yAxis: {
    axisPointer: {
         snap: 'followX'  // means follow the first x axis.
         // Or can be:
         // snap: {xAxisIndex: 2}
    }
}



Before starting this work, this issue probably should be considered:
(1) Currently, axisPointer of each axis is independent, that is,
axisPointer of xAxis and
axisPointer of yAxis do not know each other, and do not communicate with
each other.
But this feature requires one axisPointer rely on an other axisPointer. We
should find
a way to make the implementation neat.
Probably we should enable Series to provide its own logic to determin the
location of
the other axisPointer in this feature.

(2) When hovering on two points with the same x value, and xAxisPointer
have snapped
on this two points, which point should the y axisPointer be located?
a) Render two y axisPoiner in this case: it is probably complicated in
implementation.
b) Chose the first one, suppose that this case is not usual.


------------------------------
 Su Shuang (100pah)
------------------------------




On Thu, 25 Oct 2018 at 13:07, Wenli Zhang <ov...@gmail.com> wrote:

> Hi dear developers,
>
> Here we'd like to discuss about
> https://github.com/apache/incubator-echarts/issues/7651 . Since the
> issues is in Chinese, here I'm going to describe it in English.
>
> [image: axisPointer position.png]
>
> Basically, it is required in the issue that the cross point of the
> axisPoint always snap to data point. In this case, the x position of the
> cross point is decided by mouse position, and the y position by the data of
> the corresponding x position.
>
> But currently, ECharts doesn't provide a method for the y position to be
> at data position. I'm not sure if *snap* is the correct word since
> currently the snap option in axisPoint seems to mean to be near to the data
> but not compulsively.
>
> Expected: https://gupiao.baidu.com/stock/sh000001.html?from=aladingpc
> Current ECharts: http://gallery.echartsjs.com/editor.html?c=x8K2BwAFx5&v=2
>
> We'd like to discuss in this email:
> 1. Should we implement the feature as the *Expected* example shows?
> 2. Should this be called *snap* or something else?
> 3. Should we provide an option or make this default?
> 4. Is there anything we should be aware of when implementing this? @100pah
>
> Zhang Wenli
> http://zhangwenli.com
>