You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by so...@apache.org on 2025/07/30 17:13:00 UTC
(superset) branch mixed-chart-tooltip-query-control created (now 7a1f4183fb)
This is an automated email from the ASF dual-hosted git repository.
sophieyou pushed a change to branch mixed-chart-tooltip-query-control
in repository https://gitbox.apache.org/repos/asf/superset.git
at 7a1f4183fb fix: use camelCase showQueryIdentifiers instead of snake_case
This branch includes the following new commits:
new 5f390a1d5e feat: add optional query identifiers to mixed timeseries charts
new d2601e4571 debug: add console logging to investigate query identifier control issue
new 7a1f4183fb fix: use camelCase showQueryIdentifiers instead of snake_case
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(superset) 02/03: debug: add console logging to investigate query identifier control issue
Posted by so...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sophieyou pushed a commit to branch mixed-chart-tooltip-query-control
in repository https://gitbox.apache.org/repos/asf/superset.git
commit d2601e45715fae5f08fb9fae3d041bad8076d2ce
Author: yousoph <so...@gmail.com>
AuthorDate: Tue Jul 29 23:56:02 2025 +0000
debug: add console logging to investigate query identifier control issue
---
.../plugin-chart-echarts/src/MixedTimeseries/transformProps.ts | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
index 0c2364a12f..30f8604c3c 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
@@ -243,6 +243,10 @@ export default function transformProps(
const MetricDisplayNameA = getMetricDisplayName(metrics[0], verboseMap);
const MetricDisplayNameB = getMetricDisplayName(metricsB[0], verboseMap);
+ // Debug logging
+ console.log('DEBUG: show_query_identifiers =', show_query_identifiers);
+ console.log('DEBUG: formData contains:', Object.keys(formData));
+
const [rawSeriesA, sortedTotalValuesA] = extractSeries(rebasedDataA, {
fillNeighborValue: stack ? 0 : undefined,
xAxis: xAxisLabel,
@@ -410,6 +414,8 @@ export default function transformProps(
? `${entryName} (Query A)`
: entryName;
}
+
+ console.log(`DEBUG Query A: entryName="${entryName}", displayName="${displayName}", show_query_identifiers=${show_query_identifiers}`);
const seriesFormatter = getFormatter(
customFormatters,
@@ -477,6 +483,8 @@ export default function transformProps(
? `${entryName} (Query B)`
: entryName;
}
+
+ console.log(`DEBUG Query B: entryName="${entryName}", displayName="${displayName}", show_query_identifiers=${show_query_identifiers}`);
const seriesFormatter = getFormatter(
customFormattersSecondary,
(superset) 03/03: fix: use camelCase showQueryIdentifiers instead of snake_case
Posted by so...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sophieyou pushed a commit to branch mixed-chart-tooltip-query-control
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 7a1f4183fb41491f100859bfef535256c615861b
Author: yousoph <so...@gmail.com>
AuthorDate: Wed Jul 30 00:03:09 2025 +0000
fix: use camelCase showQueryIdentifiers instead of snake_case
The form control uses snake_case but gets converted to camelCase when passed to transform function
---
.../src/MixedTimeseries/transformProps.ts | 17 ++++++++---------
.../plugin-chart-echarts/src/MixedTimeseries/types.ts | 4 ++--
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
index 30f8604c3c..1324547af4 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
@@ -212,7 +212,7 @@ export default function transformProps(
sortSeriesAscendingB,
timeGrainSqla,
percentageThreshold,
- show_query_identifiers = false,
+ showQueryIdentifiers = false,
metrics = [],
metricsB = [],
}: EchartsMixedTimeseriesFormData = { ...DEFAULT_FORM_DATA, ...formData };
@@ -244,8 +244,7 @@ export default function transformProps(
const MetricDisplayNameB = getMetricDisplayName(metricsB[0], verboseMap);
// Debug logging
- console.log('DEBUG: show_query_identifiers =', show_query_identifiers);
- console.log('DEBUG: formData contains:', Object.keys(formData));
+ console.log('DEBUG: showQueryIdentifiers =', showQueryIdentifiers);
const [rawSeriesA, sortedTotalValuesA] = extractSeries(rebasedDataA, {
fillNeighborValue: stack ? 0 : undefined,
@@ -404,18 +403,18 @@ export default function transformProps(
if (groupby.length > 0) {
// When we have groupby, format as "metric, dimension"
- const metricPart = show_query_identifiers
+ const metricPart = showQueryIdentifiers
? `${MetricDisplayNameA} (Query A)`
: MetricDisplayNameA;
displayName = `${metricPart}, ${entryName}`;
} else {
// When no groupby, format as just the entry name with optional query identifier
- displayName = show_query_identifiers
+ displayName = showQueryIdentifiers
? `${entryName} (Query A)`
: entryName;
}
- console.log(`DEBUG Query A: entryName="${entryName}", displayName="${displayName}", show_query_identifiers=${show_query_identifiers}`);
+ console.log(`DEBUG Query A: entryName="${entryName}", displayName="${displayName}", showQueryIdentifiers=${showQueryIdentifiers}`);
const seriesFormatter = getFormatter(
customFormatters,
@@ -473,18 +472,18 @@ export default function transformProps(
if (groupbyB.length > 0) {
// When we have groupby, format as "metric, dimension"
- const metricPart = show_query_identifiers
+ const metricPart = showQueryIdentifiers
? `${MetricDisplayNameB} (Query B)`
: MetricDisplayNameB;
displayName = `${metricPart}, ${entryName}`;
} else {
// When no groupby, format as just the entry name with optional query identifier
- displayName = show_query_identifiers
+ displayName = showQueryIdentifiers
? `${entryName} (Query B)`
: entryName;
}
- console.log(`DEBUG Query B: entryName="${entryName}", displayName="${displayName}", show_query_identifiers=${show_query_identifiers}`);
+ console.log(`DEBUG Query B: entryName="${entryName}", displayName="${displayName}", showQueryIdentifiers=${showQueryIdentifiers}`);
const seriesFormatter = getFormatter(
customFormattersSecondary,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
index 9c5ad1b636..d73a1c2c07 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
@@ -60,7 +60,7 @@ export type EchartsMixedTimeseriesFormData = QueryFormData & {
tooltipTimeFormat?: string;
zoomable: boolean;
richTooltip: boolean;
- show_query_identifiers?: boolean;
+ showQueryIdentifiers?: boolean;
xAxisLabelRotation: number;
xAxisLabelInterval?: number | string;
colorScheme?: string;
@@ -134,7 +134,7 @@ export const DEFAULT_FORM_DATA: EchartsMixedTimeseriesFormData = {
groupbyB: [],
zoomable: TIMESERIES_DEFAULTS.zoomable,
richTooltip: TIMESERIES_DEFAULTS.richTooltip,
- show_query_identifiers: false,
+ showQueryIdentifiers: false,
xAxisLabelRotation: TIMESERIES_DEFAULTS.xAxisLabelRotation,
xAxisLabelInterval: TIMESERIES_DEFAULTS.xAxisLabelInterval,
...DEFAULT_TITLE_FORM_DATA,
(superset) 01/03: feat: add optional query identifiers to mixed timeseries charts
Posted by so...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sophieyou pushed a commit to branch mixed-chart-tooltip-query-control
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 5f390a1d5ea35ba5969d7e792e49afbf36cb1b9b
Author: yousoph <so...@gmail.com>
AuthorDate: Tue Jul 29 23:50:44 2025 +0000
feat: add optional query identifiers to mixed timeseries charts
- Add 'Show query identifiers' checkbox control to MixedTimeseries chart
- Control appears above Rich tooltip in the Tooltip section
- Default behavior: unchecked (no Query A/B identifiers shown)
- When checked: adds (Query A) and (Query B) to legend and series names
- Updates legend to use transformed series names instead of raw names
- Conditional logic based on show_query_identifiers form data
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <no...@anthropic.com>
---
.../src/MixedTimeseries/controlPanel.tsx | 17 +++++++++++-
.../src/MixedTimeseries/transformProps.ts | 32 +++++++++++++++++-----
.../src/MixedTimeseries/types.ts | 2 ++
3 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx
index 6bc7643c84..52e7d4233a 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx
@@ -358,7 +358,22 @@ const config: ControlPanelConfig = {
['x_axis_time_format'],
[xAxisLabelRotation],
[xAxisLabelInterval],
- ...richTooltipSection,
+ [<ControlSubSectionHeader>{t('Tooltip')}</ControlSubSectionHeader>],
+ [
+ {
+ name: 'show_query_identifiers',
+ config: {
+ type: 'CheckboxControl',
+ label: t('Show query identifiers'),
+ description: t(
+ 'Add Query A and Query B identifiers to legend and tooltip to help differentiate series',
+ ),
+ default: false,
+ renderTrigger: true,
+ },
+ },
+ ],
+ ...richTooltipSection.slice(1), // Skip the tooltip header since we added our own
// eslint-disable-next-line react/jsx-key
[<ControlSubSectionHeader>{t('Y Axis')}</ControlSubSectionHeader>],
[
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
index fc2a6fe438..0c2364a12f 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
@@ -212,6 +212,7 @@ export default function transformProps(
sortSeriesAscendingB,
timeGrainSqla,
percentageThreshold,
+ show_query_identifiers = false,
metrics = [],
metricsB = [],
}: EchartsMixedTimeseriesFormData = { ...DEFAULT_FORM_DATA, ...formData };
@@ -395,10 +396,19 @@ export default function transformProps(
const seriesName = inverted[entryName] || entryName;
const colorScaleKey = getOriginalSeries(seriesName, array);
- let displayName = `${entryName} (Query A)`;
+ let displayName: string;
if (groupby.length > 0) {
- displayName = `${MetricDisplayNameA} (Query A), ${entryName}`;
+ // When we have groupby, format as "metric, dimension"
+ const metricPart = show_query_identifiers
+ ? `${MetricDisplayNameA} (Query A)`
+ : MetricDisplayNameA;
+ displayName = `${metricPart}, ${entryName}`;
+ } else {
+ // When no groupby, format as just the entry name with optional query identifier
+ displayName = show_query_identifiers
+ ? `${entryName} (Query A)`
+ : entryName;
}
const seriesFormatter = getFormatter(
@@ -453,10 +463,19 @@ export default function transformProps(
const seriesName = `${seriesEntry} (1)`;
const colorScaleKey = getOriginalSeries(seriesEntry, array);
- let displayName = `${entryName} (Query B)`;
+ let displayName: string;
if (groupbyB.length > 0) {
- displayName = `${MetricDisplayNameB} (Query B), ${entryName}`;
+ // When we have groupby, format as "metric, dimension"
+ const metricPart = show_query_identifiers
+ ? `${MetricDisplayNameB} (Query B)`
+ : MetricDisplayNameB;
+ displayName = `${metricPart}, ${entryName}`;
+ } else {
+ // When no groupby, format as just the entry name with optional query identifier
+ displayName = show_query_identifiers
+ ? `${entryName} (Query B)`
+ : entryName;
}
const seriesFormatter = getFormatter(
@@ -696,14 +715,13 @@ export default function transformProps(
zoomable,
),
// @ts-ignore
- data: rawSeriesA
- .concat(rawSeriesB)
+ data: series
.filter(
entry =>
extractForecastSeriesContext((entry.name || '') as string).type ===
ForecastSeriesEnum.Observation,
)
- .map(entry => entry.name || '')
+ .map(entry => entry.id || entry.name || '')
.concat(extractAnnotationLabels(annotationLayers, annotationData)),
},
series: dedupSeries(reorderForecastSeries(series) as SeriesOption[]),
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
index a8a2bac65d..9c5ad1b636 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
@@ -60,6 +60,7 @@ export type EchartsMixedTimeseriesFormData = QueryFormData & {
tooltipTimeFormat?: string;
zoomable: boolean;
richTooltip: boolean;
+ show_query_identifiers?: boolean;
xAxisLabelRotation: number;
xAxisLabelInterval?: number | string;
colorScheme?: string;
@@ -133,6 +134,7 @@ export const DEFAULT_FORM_DATA: EchartsMixedTimeseriesFormData = {
groupbyB: [],
zoomable: TIMESERIES_DEFAULTS.zoomable,
richTooltip: TIMESERIES_DEFAULTS.richTooltip,
+ show_query_identifiers: false,
xAxisLabelRotation: TIMESERIES_DEFAULTS.xAxisLabelRotation,
xAxisLabelInterval: TIMESERIES_DEFAULTS.xAxisLabelInterval,
...DEFAULT_TITLE_FORM_DATA,