-
Notifications
You must be signed in to change notification settings - Fork 185
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
feat: provide option to refresh range axis label #766
feat: provide option to refresh range axis label #766
Conversation
- add refreshRangeAxisLabel option (default to false) - add filterDataForRangeAxisLabel() in zoom service to provide data in zoom domain
packages/core/src/configuration.ts
Outdated
@@ -149,7 +149,8 @@ const axisChart: AxisChartOptions = Tools.merge({}, chart, { | |||
zoomBar: { | |||
top: { | |||
enabled: false, | |||
type: ZoomBarTypes.GRAPH_VIEW | |||
type: ZoomBarTypes.GRAPH_VIEW, | |||
refreshRangeAxisLabel: false |
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.
Not sure if this makes sense here. What if in top you set refreshRangeAxisLabel
to true and in bottom you set it to false? Seems like this would be a zoomBar
level config. And it should probably be called updateRangeAxis
or realtimeRangeAxis
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.
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.
@theiliad
One more thought, how about moving this configuration toAxisOptions
?
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.
well that depends. It seems like this is only relevant when you have a zoombar, isn't that the case?
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.
Yes, so far this option is required only zoom bar is enabled.
However, putting all axis-related options in the same AxisOptions
also makes sense to me.
It's up to you.
Please let me know where you like to set this option, thanks.
@hlyang397 how much have you tested this? what if you start with an initial zoom domain that has a smaller y-axis range and then you zoom-out all the way? Will you see the full range at all times? |
The y-axis range will be updated whenever zoom domain is changing, so it doesn't matter whether the chart starts from a smaller or bigger range. |
Yes I'm asking about the case when |
@theiliad |
/** | ||
* whether keep updating range axis in real time while zoom domain is changing | ||
*/ | ||
updateRangeAxis?: boolean; |
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.
I've already commented on this before, not sure where my comment went (usually they disappear if you force-push over the branch and the lines that were commented on get removed).
This seems like it should just be flag under:
{
axes: {
"top|left|bottom|right": {
update: boolean;
}
}
}
whether it needs to be called update
or updateWhenZooming
depends on whether this only applies to zooming or not
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.
I will change it to updateWhenZooming
since the axis won't change when zoom bar is disabled.
Updated in a224ab3.
@theiliad I don't think we have any force-push in this PR. In that case, we should be able to find the force-push record like this: |
yes, what I was saying about this is that if I comment on line X and that line has been removed in a force-pushed commit, then the comment seems to get deleted forever on Github. |
@theiliad So any other comment on this PR? |
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.
A bit unhappy that this is really just focusing on the main y-axis and not also the main x-axis, however I can't stand in the way of your progress
@hlyang397 please fix the conflicts |
# Conflicts: # packages/core/src/interfaces/axis-scales.ts
180b0b5
@theiliad We don't have vertical zoom bar yet, so I can't test this feature on main x-axis, and that's why I focus on main y-axis for now. |
@sophiiae Latest master branch merged. Thanks. |
# Conflicts: # packages/core/src/services/zoom.ts
387c68b
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.
LGTM!
packages/core/src/services/zoom.ts
Outdated
this.model.getOptions(), | ||
"axes", | ||
this.services.cartesianScales.getMainYAxisPosition(), | ||
"updateWhenZooming" |
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.
I was just testing this and realized that updateWhenZooming
is available for all axes, however it only takes effect for the main Y-axis. this means that I can set it to false for the main X-axis and it will do nothing
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.
we should either just make it available for the range axis like before, or if we are allowing it to be used for all axis then it should achieve something when set to false
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.
61ad8a8
to
858b62f
Compare
@theiliad Not sure what happened to Travis CI, I can pass the test locally. |
…m#766) * feat: provide option to refresh range axis label - add refreshRangeAxisLabel option (default to false) - add filterDataForRangeAxisLabel() in zoom service to provide data in zoom domain * refactor: move updateRangeAxis to zoomBarsOptions * refactor: use configs object instead of boolean as parameter * refactor: move updateWhenZooming option to be under axis option * refactor: change updateWhenZooming option to zoomBar.updateRangeAxis
Sometimes data value varies from 10 to 100,000. When zoom bar is moving, the range axis (y-axis) label should be refreshed immediately to avoid extremely small graphs.
Updates
Demo screenshot or recording
Option disabled (default) :
Option enabled:
Review checklist (for reviewers only)