fix(Axis): Correct time axis bandwidth calculation #20235
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Brief Information
This pull request is in the type of:
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 isshadow
, only a line close to 0 is displayed.时间戳数据之间的间隔可能不均匀,因此数据长度的差值无法准确反映数据点数量,导致时间类型的轴无法计算得到正确的bandwidth值,当axispointer的type为shadow的时候,只显示一条接近于0的线
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 属性代表时间刻度的平均间隔,通过除以这个间隔并向上取整,可以更准确地估算出数据点的数量,从而得到有宽度的矩形高亮区
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