-
Notifications
You must be signed in to change notification settings - Fork 19.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dataZoom inside with option pinned 'start' 'end' #20829
base: master
Are you sure you want to change the base?
Conversation
example: option { dataZoom: [ { type: 'inside', xAxisIndex: [0, 1], start: 10, end: 100, anchor: 'end', // acceptable values 'start', 'end' },
Thanks for your contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what does anchor: start/end
mean?
anchor: is an optional parameter that only applies to 'inside' zooming, if it is not put in 'option' it has no affect at all. The default behavior of dataZoom with the mouse wheel is : zoom in, move both edges of the data outwards towards the start and end points of the visible window, and move mored data into the window from the start and endpoints of the visible window. anchor: changes that behavior so that if the anchor parameter is: anchor: 'start' pins the oldest data so that only the newest data zooms in and out of the view window. Why is this useful? For financial charts that track information over time, (think of stock trading or monthly revenue) the users typically wants to zoom in on the most recent data. pinning the 'end' allows them to do that: To say it another way... 'anchor' allows the user to have a chart where data of interest is held in one spot at the edge of the chart while bringing zooming more or less time related data into the viewable focus window at exactly the anchored data point. With the start or end pinned /anchored, the anchored point can still be moved by dragging the chart or using the slider bar by grabbing the handles or slide tab. This is a minimal patch that I think provides a great deal of new flexibility. The reason I made the patch was that I was trying to get this affect using myChart.setOption and event handlers to do it. It can be accomplished that way but it is messy to implement with the event handlers and has a major impact on performance with pixelization and slow rendering during zoom and few other undesirable side effects. I took a look at the echarts code and saw that a simple patch with just a few lines of code would accomplish the objective with no side effects at all, hence the PR Please feel free to ask for any more details if you need them. |
example: option {
dataZoom: [
{
type: 'inside',
xAxisIndex: [0, 1],
start: 10,
end: 100,
anchor: 'end', // acceptable values 'start', 'end'
},
Brief Information
This pull request is in the type of:
What does this PR do?
during dataZoom type 'inside' optionally pins the zoom feature to 'start' or 'end' of chart
Fixed issues
Details
Before: What was the problem?
After: How does it behave after the fixing?
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