Skip to content

Conversation

adaelixir
Copy link

@adaelixir adaelixir commented Aug 6, 2024

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Added a method to calculate the bandwidth of the time axis, and fixed the problem of not displaying the width when the axisPointer type is shadow.
添加时间坐标轴关于bandwidth的计算方法,修复axisPointer type为shadow时,不显示宽度的问题

Fixed issues

Details

Before: What was the problem?

The intervals between timestamp data may be uneven, so the difference in data length cannot accurately reflect the number of data points, resulting in the inability to calculate the correct bandwidth value for the time type axis. When the axisPointer type is shadow, only a line close to 0 is displayed.
时间戳数据之间的间隔可能不均匀,因此数据长度的差值无法准确反映数据点数量,导致时间类型的轴无法计算得到正确的bandwidth值,当axispointer的type为shadow的时候,只显示一条接近于0的线

截屏2024-08-07 01 45 14

After: How does it behave after the fixing?

Added a method to calculate data length. When the axis type is time, the _approxInterval attribute is used to represent the average interval of the time scale. By dividing by this interval and rounding up, the number of data points can be estimated more accurately.
添加数据长度的计算方法,当轴的类型为时间时,利用_approxInterval 属性代表时间刻度的平均间隔,通过除以这个间隔并向上取整,可以更准确地估算出数据点的数量,从而得到有宽度的矩形高亮区

截屏2024-08-07 01 44 39

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

  • Please squash the commits into a single one when merging.

Other information

Copy link

echarts-bot bot commented Aug 6, 2024

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.

@adaelixir
Copy link
Author

adaelixir commented Aug 8, 2024

After the modification, the width of the shadow does not specifically indicate any meaning; and if it is for an uneven axis, this shadow will also cause problems.
在修改后,shadow的宽度并不能具体表明任何含义;而且如果对于不均匀的轴来说,这个shadow也会出问题
Logically, the shadow should express the range corresponding to the highlighted data, but for numerical types such as value and time, the axis is continuous and there is no concept of range.
从逻辑上讲,shadow 应该表达的是高亮数据对应的范围,但是 value、time 这种数值型的,轴是连续的,没有范围的概念
If it is for visual effects, you can use type as line and adjust the width through lineStyle to interact
如果是为了视觉效果,可以采用type为line,通过lineStyle调整线宽来进行交互,link

5bd7736736b7750a0a15dec7ac804855

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant