Skip to content

Commit 2dafca6

Browse files
committed
feat: add dataZoom to type inside
1 parent c6bbf53 commit 2dafca6

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ const config: ControlPanelConfig = {
158158
},
159159
},
160160
],
161+
['zoomable'],
161162
],
162163
},
163164
],

superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/transformProps.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export default function transformProps(
7373
yAxisTitleMargin,
7474
yAxisTitlePosition,
7575
sliceId,
76+
zoomable,
7677
} = formData as BoxPlotQueryFormData;
7778
const refs: Refs = {};
7879
const colorFn = CategoricalColorNamespace.getScale(colorScheme as string);
@@ -284,6 +285,26 @@ export default function transformProps(
284285
},
285286
},
286287
series,
288+
toolbox: {
289+
show: zoomable,
290+
feature: {
291+
dataZoom: {
292+
title: {
293+
zoom: 'zoom area',
294+
back: 'restore zoom',
295+
},
296+
},
297+
},
298+
},
299+
dataZoom: zoomable
300+
? [
301+
{
302+
type: 'inside',
303+
zoomOnMouseWheel: false,
304+
moveOnMouseWheel: true,
305+
},
306+
]
307+
: [],
287308
};
288309

289310
return {

superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/transformProps.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ describe('BoxPlot transformProps', () => {
3131
whiskerOptions: 'Tukey',
3232
yAxisFormat: 'SMART_NUMBER',
3333
viz_type: 'my_chart',
34+
zoomable: true,
3435
};
3536
const chartProps = new ChartProps({
3637
formData,
@@ -75,6 +76,13 @@ describe('BoxPlot transformProps', () => {
7576
width: 800,
7677
height: 600,
7778
echartOptions: expect.objectContaining({
79+
dataZoom: expect.arrayContaining([
80+
{
81+
moveOnMouseWheel: true,
82+
type: 'inside',
83+
zoomOnMouseWheel: false,
84+
},
85+
]),
7886
series: expect.arrayContaining([
7987
expect.objectContaining({
8088
name: 'boxplot',

0 commit comments

Comments
 (0)