-
Notifications
You must be signed in to change notification settings - Fork 355
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
[API] Impossible to unset min/max on axis #2398
Comments
For documentation: The workaround obviously is just copy-pasting the code using .internal:
(Probably the XDomain properties can be dropped when Y is updated like here.) |
The current best way to reset, would be: chart.config("axis.y.max", null, true);
chart.config("axis.y.min", null, true); It would be reasonable provide some way to reset the range as you suggested. I'll try consider this for next release. Thanks! |
Since I'm always doing both at once, it's probably better to call redraw only once?
|
@adschm, I'm working on this. As your recommendation the reset of range will accept chart.axis.range({
min: { y: 1000, y2: false } // will set y's min as 1000, but will reset y2 min value
});
chart.axis.min({y: -100}); // set
chart.axis.min({y: false}); // unset |
Add capability to reset specified axis range min/max value Ref naver#2398
Add capability to reset specified axis range min/max value Ref naver#2398
# [3.4.0-next.2](3.4.0-next.1...3.4.0-next.2) (2022-03-24) ### Bug Fixes * **api:** Fix flow on indexed/category axis type ([4aba436](4aba436)), closes [#2595](#2595) ### Features * **api:** Implement axis range reset ([6c9d99e](6c9d99e)), closes [#2398](#2398) * **option:** Intent to ship onclick ([63c5a53](63c5a53)), closes [#2587](#2587)
# [3.4.0](3.3.3...3.4.0) (2022-03-31) ### Bug Fixes * **api:** Fix flow on indexed/category axis type ([4aba436](4aba436)), closes [#2595](#2595) * **axis:** Fix culling visibility on dynamic loading ([4c79daf](4c79daf)), closes [#2582](#2582) * **axis:** fix hidden axis rescale on dynamic load ([5418853](5418853)), closes [#2523](#2523) [#2571](#2571) * **generator:** Prevent possible infinite loop when tab isn't visible ([bafdb17](bafdb17)), closes [#2606](#2606) * **option:** Fix data.hide not working for bubble/scatter type ([64ae74b](64ae74b)), closes [#2609](#2609) * **util:** Check if agent has mouse ([d42adaa](d42adaa)), closes [#2550](#2550) [#2585](#2585) * **util:** Enhance parsing date string ([8d9f422](8d9f422)), closes [#1714](#1714) ### Features * **api:** Implement axis range reset ([6c9d99e](6c9d99e)), closes [#2398](#2398) * **option:** Intent to ship onclick ([63c5a53](63c5a53)), closes [#2587](#2587) * **polar:** Intent to ship polar type ([feca715](feca715)), closes [#2462](#2462)
I'm trying to implement an option which would allow to toggle specific values for the min/max boundaries of the y axis.
Problem:
It's quite simple to enable min/max limits:
mychart.axis.range({max: {y: 140}, min:{y:60}});
But once they are enabled, it's impossible to get rid of them via the API:
y: ...
will get filtered by the code, nothing happens.mychart.axis.range{max: false, min: false}
will reset max and keep min, since both have different algorithms for checking [1] [2]Possible solutions:
There is no obvious clean way to solve/implement this.
Giving
undefined
as value doesn't seem right:mychart.axis.range({max: {y: undefined}, min:{y: undefined}});
IMO the best comprise would be to accept
false
instead of a value, and then adjust the code in setMinMax to set "undefined" when a value is matched against=== false
, so one could unset with:mychart.axis.range({max: {y: false}, min:{y: false}});
If implemented properly, this should keep the ability to change the min/max of individual axes without touching the others, as it's possible at the moment.
And of course, the checks for min() and max() should be harmonized.
Ref:
[1] https://github.com/naver/billboard.js/blob/master/src/Chart/api/axis.ts#L153
[2] https://github.com/naver/billboard.js/blob/master/src/Chart/api/axis.ts#L128
The text was updated successfully, but these errors were encountered: