You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/07/20 17:32:43 UTC
(superset) branch master updated: fix(Calendar Heatmap): Add Back chart options for Calendar Heatmap (#26230)
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 940e2c34a25 fix(Calendar Heatmap): Add Back chart options for Calendar Heatmap (#26230)
940e2c34a25 is described below
commit 940e2c34a25e661a8eefe5ca5cb22807883eb7dd
Author: Matthew Chiang <36...@users.noreply.github.com>
AuthorDate: Mon Jul 20 10:32:35 2026 -0700
fix(Calendar Heatmap): Add Back chart options for Calendar Heatmap (#26230)
Co-authored-by: Claude <cl...@anthropic.com>
Co-authored-by: Claude Opus 4.8 (1M context) <no...@anthropic.com>
Co-authored-by: Evan Rusackas <ev...@rusackas.com>
---
.../legacy-plugin-chart-calendar/src/Calendar.ts | 16 +++++++---
.../src/controlPanel.ts | 37 ++++++++++++++++++++--
.../src/transformProps.ts | 4 +++
3 files changed, 51 insertions(+), 6 deletions(-)
diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.ts b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.ts
index a36d6a2648c..0cec9b15882 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.ts
@@ -56,6 +56,8 @@ interface CalendarProps {
valueFormatter: (value: number) => string;
verboseMap: Record<string, string>;
theme: SupersetTheme;
+ colorRangeEnd?: number;
+ colorRangeStart?: number;
}
function Calendar(element: HTMLElement, props: CalendarProps) {
@@ -76,6 +78,8 @@ function Calendar(element: HTMLElement, props: CalendarProps) {
valueFormatter,
verboseMap,
theme,
+ colorRangeEnd,
+ colorRangeStart,
} = props;
const container = d3Select(element)
@@ -98,10 +102,14 @@ 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 useCustomColorRange =
+ Number.isFinite(colorRangeStart) && Number.isFinite(colorRangeEnd);
+ const rawExtents = useCustomColorRange
+ ? ([
+ Math.min(colorRangeStart as number, colorRangeEnd as number),
+ Math.max(colorRangeStart as number, colorRangeEnd as number),
+ ] as [number, number])
+ : d3Extent(Object.keys(timestamps), key => timestamps[key]);
// Guard against undefined extents (empty data)
const extents: [number, number] =
rawExtents[0] != null && rawExtents[1] != null
diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts
index e71c6c15a32..03c3b6ec8c2 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/controlPanel.ts
@@ -82,7 +82,7 @@ const config: ControlPanelConfig = {
{
label: t('Chart Options'),
expanded: true,
- tabOverride: 'customize',
+ description: t('Options'),
controlSetRows: [
['linear_color_scheme'],
[
@@ -137,6 +137,40 @@ 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(
+ 'Lower bound of the color scale. When both start and end are ' +
+ 'set, the legend uses this fixed range instead of the ' +
+ 'automatic data range.',
+ ),
+ },
+ },
+ {
+ name: 'color_range_end',
+ config: {
+ type: 'TextControl',
+ isInt: true,
+ validators: [legacyValidateInteger],
+ renderTrigger: true,
+ default: undefined,
+ label: t('Color Range End'),
+ description: t(
+ 'Upper bound of the color scale. When both start and end are ' +
+ 'set, the legend uses this fixed range instead of the ' +
+ 'automatic data range.',
+ ),
+ },
+ },
+ ],
[
'y_axis_format',
{
@@ -182,7 +216,6 @@ const config: ControlPanelConfig = {
config: {
type: 'CheckboxControl',
label: t('Show Metric Names'),
- renderTrigger: true,
default: true,
description: t('Whether to display the metric name as a title'),
},
diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/transformProps.ts b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/transformProps.ts
index b20773ee70d..74e599148ed 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-calendar/src/transformProps.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/src/transformProps.ts
@@ -35,6 +35,8 @@ export default function transformProps(chartProps: ChartProps) {
subdomainGranularity,
xAxisTimeFormat,
yAxisFormat,
+ colorRangeEnd,
+ colorRangeStart,
} = formData;
const { verboseMap } = datasource;
@@ -58,5 +60,7 @@ export default function transformProps(chartProps: ChartProps) {
timeFormatter,
valueFormatter,
verboseMap,
+ colorRangeEnd,
+ colorRangeStart,
};
}