You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ha...@apache.org on 2026/08/15 07:16:36 UTC

(superset) branch master updated: fix(charts): fix Bubble chart crash and correct example's time_range to a year with real data (#43201)

This is an automated email from the ASF dual-hosted git repository.

hainenber 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 f7c70568c3f fix(charts): fix Bubble chart crash and correct example's time_range to a year with real data (#43201)
f7c70568c3f is described below

commit f7c70568c3f474b25cf4173b2d22644f42434433
Author: Evan Rusackas <ev...@preset.io>
AuthorDate: Sat Aug 15 00:16:29 2026 -0700

    fix(charts): fix Bubble chart crash and correct example's time_range to a year with real data (#43201)
    
    Co-authored-by: Claude Code <no...@anthropic.com>
---
 .../src/Bubble/transformProps.test.ts              | 70 ++++++++++++++++++++++
 .../src/Bubble/transformProps.ts                   |  7 ++-
 .../charts/Life_Expectancy_VS_Rural.yaml           |  2 +-
 3 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.test.ts
new file mode 100644
index 00000000000..77134ed11f5
--- /dev/null
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.test.ts
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { SqlaFormData } from '@superset-ui/core';
+import transformProps from './transformProps';
+import { EchartsBubbleChartProps } from './types';
+
+const baseFormData: SqlaFormData = {
+  datasource: '1__table',
+  viz_type: 'bubble_v2',
+  entity: 'customer_name',
+  x: 'price',
+  y: 'sales',
+  size: 'count',
+};
+
+const baseChartProps = {
+  width: 400,
+  height: 400,
+  hooks: {},
+  queriesData: [
+    {
+      data: [
+        { customer_name: 'A', price: 10, sales: 100, count: 5 },
+        { customer_name: 'B', price: 20, sales: 200, count: 8 },
+      ],
+    },
+  ],
+  theme: { colorText: '#000' },
+};
+
+test('nests xAxisLabelInterval under axisLabel rather than the axis itself', () => {
+  // Regression test: xAxis.interval forces echarts' IntervalScale into a
+  // fixed-tick-spacing mode that expects a number and crashes on the
+  // 'auto'/'0' strings this control actually produces (observed as an
+  // uncaught assertion deep in echarts' axis "nice" tick calculation,
+  // reproducing on every dashboard bubble chart). The interval belongs on
+  // axisLabel, where it only controls how many labels are skipped.
+  const { echartOptions } = transformProps({
+    ...baseChartProps,
+    formData: baseFormData,
+  } as unknown as EchartsBubbleChartProps);
+
+  expect((echartOptions.xAxis as any).interval).toBeUndefined();
+  expect((echartOptions.xAxis as any).axisLabel.interval).toBe('auto');
+});
+
+test('honors an explicit xAxisLabelInterval override', () => {
+  const { echartOptions } = transformProps({
+    ...baseChartProps,
+    formData: { ...baseFormData, xAxisLabelInterval: '0' },
+  } as unknown as EchartsBubbleChartProps);
+
+  expect((echartOptions.xAxis as any).axisLabel.interval).toBe('0');
+});
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.ts
index 8d94a301ed2..1efe7b93b73 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Bubble/transformProps.ts
@@ -212,13 +212,16 @@ export default function transformProps(chartProps: EchartsBubbleChartProps) {
   const echartOptions: EChartsCoreOption = {
     series,
     xAxis: {
-      axisLabel: { formatter: xAxisFormatter, rotate: xAxisLabelRotation },
+      axisLabel: {
+        formatter: xAxisFormatter,
+        rotate: xAxisLabelRotation,
+        interval: xAxisLabelInterval,
+      },
       splitLine: {
         lineStyle: {
           type: 'dashed',
         },
       },
-      interval: xAxisLabelInterval,
       scale: true,
       name: bubbleXAxisTitle,
       nameLocation: 'middle',
diff --git a/superset/examples/world_health/charts/Life_Expectancy_VS_Rural.yaml b/superset/examples/world_health/charts/Life_Expectancy_VS_Rural.yaml
index 2a87f708fa9..dc02ec5f986 100644
--- a/superset/examples/world_health/charts/Life_Expectancy_VS_Rural.yaml
+++ b/superset/examples/world_health/charts/Life_Expectancy_VS_Rural.yaml
@@ -59,7 +59,7 @@ params:
     expressionType: SIMPLE
     label: SUM(SP_POP_TOTL)
     optionName: metric_size_life_expectancy_vs_rural
-  time_range: '2014-01-01 : 2014-01-02'
+  time_range: '2011-01-01 : 2011-01-02'
   tooltipSizeFormat: SMART_NUMBER
   truncateXAxis: true
   viz_type: bubble_v2