feat(dataZoom): `valueRange` for `dataZoom` event
Brief Information
This pull request is in the type of:
- [ ] bug fixing
- [x] new feature
- [ ] others
What does this PR do?
Expose startValue and endValue at dataZoom event
Fixed issues
- Close #10700
Details
Before: What was the problem?
After: How does it behave after the fixing?
Document Info
One of the following should be checked.
- [ ] This PR doesn't relate to document changes
- [ ] The document should be updated later
- [x] The document changes have been made in apache/echarts-doc#10700
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
- [x] Please squash the commits into a single one when merging.
Other information
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.
The pull request is marked to be PR: author is committer because you are a committer of this project.
Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the PR: awaiting doc label.
The document should be updated by removing "only exists in zoom event of triggered by toolbar".
The document should be updated by removing "only exists in zoom event of triggered by toolbar".
Created a PR for it.
Looks good. if (dataZoomModel.get('showDetail')) is not a mistake. It's just the old logic only used dataInterval to display the labels and didn't save it to_dataRange.
Seems the valueRange is updated after the action being dispatched. I guess in the event startValue and endValue will not be the latest value? A test will be good to verify it
Any update on this PR? This would be really helpful as there's merely no way to map start/end percentage to values in the same way as ECharts does accurately.
Seems the valueRange is updated after the action being dispatched. I guess in the event
startValueandendValuewill not be the latest value? A test will be good to verify it
@pissang @Ovilia @plainheart The missing person has returned, Sorry I haven't checked this in time, had very busy two months.
The timing for calculating _valueRange has moved after the calculation of range. This might be the better way, cause dataZoom event rely on range as well as _valueRange, so this two variable could be calculated at same time
By the way, if an xAxis.type is set to time, a dataZoom.startValue and dataZoom.endValue properties will return formatted values, which makes it difficult to map them back to the original data. For example, if your dataset value is 1682850281010, the dataZoom.startValue will be 1682850281399.8394. Even if you use an ISO string format instead of a timestamp, the dataZoom object will still return a formatted value