You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/07/08 00:09:41 UTC
Re: [PR] fix(Calendar Heatmap): Add Back chart options for Calendar Heatmap [superset]
rusackas commented on code in PR #26230:
URL: https://github.com/apache/superset/pull/26230#discussion_r3540414922
##########
superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts:
##########
@@ -135,6 +135,32 @@ const config: ControlPanelConfig = {
},
},
],
+ [
+ {
+ name: 'color_range_start',
+ config: {
+ type: 'TextControl',
+ isInt: true,
+ validators: [legacyValidateInteger],
+ renderTrigger: true,
+ default: undefined,
+ label: t('Color Range Start'),
+ description: t('test'),
Review Comment:
Good call, swapped the `test` placeholder for a real description of what the bound actually does. Thanks!
##########
superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts:
##########
@@ -135,6 +135,32 @@ const config: ControlPanelConfig = {
},
},
],
+ [
+ {
+ name: 'color_range_start',
+ config: {
+ type: 'TextControl',
+ isInt: true,
+ validators: [legacyValidateInteger],
+ renderTrigger: true,
+ default: undefined,
+ label: t('Color Range Start'),
+ description: t('test'),
+ },
+ },
+ {
+ name: 'color_range_end',
+ config: {
+ type: 'TextControl',
+ isInt: true,
+ validators: [legacyValidateInteger],
+ renderTrigger: true,
+ default: undefined,
+ label: t('Color Range End'),
+ description: t('test'),
Review Comment:
Same here, done.
##########
superset-frontend/plugins/legacy-plugin-chart-calendar/src/transformProps.ts:
##########
@@ -35,12 +35,21 @@ export default function transformProps(chartProps) {
subdomainGranularity,
xAxisTimeFormat,
yAxisFormat,
+ colorRangeEnd,
+ colorRangeStart,
} = formData;
const { verboseMap } = datasource;
const timeFormatter = ts => getFormattedUTCTime(ts, xAxisTimeFormat);
const valueFormatter = getNumberFormatter(yAxisFormat);
+ // Get the color range if both are specified
+ const useCustomColorRange =
Review Comment:
Yeah, good call. Went with `Number.isFinite` rather than pulling `isNumber` in from lodash since it's built-in and also rules out `NaN`, but same intent.
##########
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 - 1] as [number, number])
Review Comment:
Good catch, the `- 1` was lopping the top off the user's range. Using the exact end value now.
##########
superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts:
##########
@@ -136,6 +136,32 @@ const config: ControlPanelConfig = {
},
},
],
+ [
+ {
+ name: 'color_range_start',
+ config: {
+ type: 'TextControl',
+ isInt: true,
+ validators: [legacyValidateInteger],
+ renderTrigger: true,
+ default: undefined,
+ label: t('Color Range Start'),
+ description: t('test'),
Review Comment:
Yep, real descriptions in now instead of the `test` placeholder.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org