michael-s-molina commented on code in PR #24012:
URL: https://github.com/apache/superset/pull/24012#discussion_r1273949392
##########
superset-frontend/src/filters/components/Range/RangeFilterPlugin.tsx:
##########
@@ -300,6 +300,16 @@ export default function RangeFilterPlugin(props:
PluginFilterRangeProps) {
}
}, [enableSingleExactValue]);
+ const MIN_NUM_STEPS = 20;
+ const stepHeuristic = (min: number, max: number) => {
+ const maxStepSize = (max - min) / MIN_NUM_STEPS;
+ // normalizedStepSize: .06 -> .01, .003 -> .001
+ const normalizedStepSize = `1E${Math.floor(Math.log10(maxStepSize))}`;
+ return Math.min(1, parseFloat(normalizedStepSize));
+ };
+
+ const step = stepHeuristic(min, max);
Review Comment:
```suggestion
const step = max - min <= 1 ? stepHeuristic(min, max) : 1;
```
##########
superset-frontend/src/filters/components/Range/RangeFilterPlugin.tsx:
##########
@@ -300,6 +300,16 @@ export default function RangeFilterPlugin(props:
PluginFilterRangeProps) {
}
}, [enableSingleExactValue]);
+ const MIN_NUM_STEPS = 20;
+ const stepHeuristic = (min: number, max: number) => {
+ const maxStepSize = (max - min) / MIN_NUM_STEPS;
+ // normalizedStepSize: .06 -> .01, .003 -> .001
+ const normalizedStepSize = `1E${Math.floor(Math.log10(maxStepSize))}`;
+ return Math.min(1, parseFloat(normalizedStepSize));
+ };
+
+ const step = stepHeuristic(min, max);
Review Comment:
```suggestion
const step = max - min <= 1 ? stepHeuristic(min, max) : 1;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]