You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by kg...@apache.org on 2023/07/10 16:04:46 UTC
[superset] branch master updated: fix: Ensure metrics is an array in Mixed Chart (#24643)
This is an automated email from the ASF dual-hosted git repository.
kgabryje 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 fe2c14ff3a fix: Ensure metrics is an array in Mixed Chart (#24643)
fe2c14ff3a is described below
commit fe2c14ff3acad11bf0f6a7b6544dfc52a6612152
Author: Kamil Gabryjelski <ka...@gmail.com>
AuthorDate: Mon Jul 10 18:04:38 2023 +0200
fix: Ensure metrics is an array in Mixed Chart (#24643)
---
.../src/MixedTimeseries/transformProps.ts | 4 ++--
superset/examples/birth_names.py | 18 ++++++++++--------
2 files changed, 12 insertions(+), 10 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 a3028bfef8..331ddf190c 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
@@ -223,13 +223,13 @@ export default function transformProps(
contributionMode ? ',.0%' : yAxisFormatSecondary,
);
const customFormatters = buildCustomFormatters(
- [...metrics, ...metricsB],
+ [...ensureIsArray(metrics), ...ensureIsArray(metricsB)],
currencyFormats,
columnFormats,
yAxisFormat,
);
const customFormattersSecondary = buildCustomFormatters(
- [...metrics, ...metricsB],
+ [...ensureIsArray(metrics), ...ensureIsArray(metricsB)],
currencyFormats,
columnFormats,
yAxisFormatSecondary,
diff --git a/superset/examples/birth_names.py b/superset/examples/birth_names.py
index 8b09aa4bf2..f9bbf8a79b 100644
--- a/superset/examples/birth_names.py
+++ b/superset/examples/birth_names.py
@@ -392,14 +392,16 @@ def create_slices(tbl: SqlaTable) -> tuple[list[Slice], list[Slice]]:
params=get_slice_json(
defaults,
viz_type="mixed_timeseries",
- metrics={
- "expressionType": "SIMPLE",
- "column": {"column_name": "num", "type": "BIGINT(20)"},
- "aggregate": "AVG",
- "label": "AVG(num)",
- "optionName": "metric_vgops097wej_g8uff99zhk7",
- },
- metrics_b="sum__num",
+ metrics=[
+ {
+ "expressionType": "SIMPLE",
+ "column": {"column_name": "num", "type": "BIGINT(20)"},
+ "aggregate": "AVG",
+ "label": "AVG(num)",
+ "optionName": "metric_vgops097wej_g8uff99zhk7",
+ }
+ ],
+ metrics_b=["sum__num"],
granularity_sqla="ds",
yAxisIndex=0,
yAxisIndexB=1,