rusackas commented on code in PR #26230:
URL: https://github.com/apache/superset/pull/26230#discussion_r3540555537


##########
superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.ts:
##########
@@ -98,10 +104,9 @@ function Calendar(element: HTMLElement, props: 
CalendarProps) {
       calContainer.text(`${METRIC_TEXT}: ${verboseMap[metric] || metric}`);
     }
     const timestamps = metricsData[metric];
-    const rawExtents = d3Extent(
-      Object.keys(timestamps),
-      key => timestamps[key],
-    );
+    const rawExtents = useCustomColorRange
+      ? ([colorRangeStart, colorRangeEnd] as [number, number])
+      : d3Extent(Object.keys(timestamps), key => timestamps[key]);

Review Comment:
   Good catch, normalized the bounds with `Math.min`/`Math.max` so a reversed 
start/end won't flip the legend.



##########
superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts:
##########
@@ -136,6 +136,40 @@ const config: ControlPanelConfig = {
             },
           },
         ],
+        [
+          {
+            name: 'color_range_start',
+            config: {
+              type: 'TextControl',
+              isInt: true,
+              validators: [legacyValidateInteger],

Review Comment:
   Going to keep these as integers for now. Swapping to `isFloat` is 
deceptively messy here, `TextControl` keeps float inputs ending in `.` or `0` 
as raw strings, which would slip past the `Number.isFinite` check 
@michael-s-molina asked for and quietly disable the custom range. Happy to 
revisit decimal bounds as a follow-up if folks want them.



-- 
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]

Reply via email to