You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "adaelixir (via GitHub)" <gi...@apache.org> on 2024/08/06 18:00:35 UTC
[PR] fix(Axis): Correct time axis bandwidth calculation [echarts]
adaelixir opened a new pull request, #20235:
URL: https://github.com/apache/echarts/pull/20235
<!-- Please fill in the following information to help us review your PR more efficiently. -->
## Brief Information
This pull request is in the type of:
- [x] bug fixing
- [ ] new feature
- [ ] others
### What does this PR do?
<!-- USE ONE SENTENCE TO DESCRIBE WHAT THIS PR DOES. -->
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
<!--
- #9843
- #15411
-->
## Details
### Before: What was the problem?
<!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
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的线
<!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
<img width="610" alt="截屏2024-08-07 01 45 14" src="https://github.com/user-attachments/assets/4672b4a0-ac97-4e99-b1c0-8448fb557df8">
### After: How does it behave after the fixing?
<!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
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 属性代表时间刻度的平均间隔,通过除以这个间隔并向上取整,可以更准确地估算出数据点的数量,从而得到有宽度的矩形高亮区
<!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
<img width="601" alt="截屏2024-08-07 01 44 39" src="https://github.com/user-attachments/assets/73ed1d10-a009-409f-9e02-ad074a8e08a5">
## Document Info
One of the following should be checked.
- [x] 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(Axis): Correct time axis bandwidth calculation [echarts]
Posted by "adaelixir (via GitHub)" <gi...@apache.org>.
adaelixir closed pull request #20235: fix(Axis): Correct time axis bandwidth calculation
URL: https://github.com/apache/echarts/pull/20235
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(Axis): Correct time axis bandwidth calculation [echarts]
Posted by "adaelixir (via GitHub)" <gi...@apache.org>.
adaelixir commented on PR #20235:
URL: https://github.com/apache/echarts/pull/20235#issuecomment-2275370548
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`调整线宽来进行交互
<img width="585" alt="5bd7736736b7750a0a15dec7ac804855" src="https://github.com/user-attachments/assets/70117bb3-bb1b-48c0-973f-fb9ff72d07c9">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(Axis): Correct time axis bandwidth calculation [echarts]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20235:
URL: https://github.com/apache/echarts/pull/20235#issuecomment-2272720491
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-20235@f743be6
<!-- ECHARTS_PR_PREVIEW -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org
Re: [PR] fix(Axis): Correct time axis bandwidth calculation [echarts]
Posted by "echarts-bot[bot] (via GitHub)" <gi...@apache.org>.
echarts-bot[bot] commented on PR #20235:
URL: https://github.com/apache/echarts/pull/20235#issuecomment-2271847197
Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org