-
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
[Feature] How to get the axis range when datazoom scales it? #17919
Comments
Maybe related to #17278 |
Not really. I believe that the PR you quoted is about to access the data window's start-end index. In my case when I move the chart, x-axis range is changing and y-axis range is scaling to reflect that change, I'd like to know what that scaled y-axis range is. |
All right. I'm sorry I misunderstood. For now, we can only get it like this, which is not a public method. const yAxisExtent = myChart
.getModel()
// get the first y-axis
.getComponent('yAxis', 0)
// get scale
.axis.scale.getExtent(); See also this demo. |
Thank you for your demo and the solution works. But since it's not public I cannot expect stability in future releases, can I? Anyway I'm closing the issue at the moment. |
It's generally okay to use this non-public API. It's just not ready to expose to the users. |
hi @plainheart, but how can I solve the ts error?
|
@bbcfive This API is not exposed, so you have to use |
What problem does this feature solve?
Hopefully the axis range could be known when it's changed.
I have y-axis
scale
set totrue
, and enableddatazoom
. When I zoom or pan the chart, clearly the y-axis's range changes too. Now I need to know the new range.I tried to listen to
datazoom
event but it doesn't look like any properties in the option could give me the values.chart.on("datazoom", params => console.log(chart.getOption().yAxis[0]))
From the output I cannot see any information showing the y-axis range. Is there a way I can get it?
What does the proposed API look like?
Add a range property in the yAxis option:
The text was updated successfully, but these errors were encountered: