From eb65cea971c9c7a184350827ebf37765b4b49863 Mon Sep 17 00:00:00 2001 From: "Michael S. Molina" <70410625+michael-s-molina@users.noreply.github.com> Date: Wed, 20 Dec 2023 08:34:27 -0300 Subject: [PATCH] chore: Disables minor ticks by default (#26310) --- .../src/MixedTimeseries/controlPanel.tsx | 2 ++ .../src/MixedTimeseries/transformProps.ts | 6 ++++-- .../plugin-chart-echarts/src/MixedTimeseries/types.ts | 1 + .../src/Timeseries/Area/controlPanel.tsx | 2 ++ .../src/Timeseries/Regular/Bar/controlPanel.tsx | 2 ++ .../src/Timeseries/Regular/Line/controlPanel.tsx | 2 ++ .../src/Timeseries/Regular/Scatter/controlPanel.tsx | 2 ++ .../Timeseries/Regular/SmoothLine/controlPanel.tsx | 2 ++ .../src/Timeseries/Step/controlPanel.tsx | 2 ++ .../src/Timeseries/transformProps.ts | 4 +++- .../plugin-chart-echarts/src/Timeseries/types.ts | 1 + .../plugins/plugin-chart-echarts/src/controls.tsx | 11 +++++++++++ 12 files changed, 34 insertions(+), 3 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 c5fed29847506..d3fb1fc53e10a 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/controlPanel.tsx @@ -34,6 +34,7 @@ import { DEFAULT_FORM_DATA } from './types'; import { EchartsTimeseriesSeriesType } from '../Timeseries/types'; import { legendSection, + minorTicks, richTooltipSection, truncateXAxis, xAxisBounds, @@ -316,6 +317,7 @@ const config: ControlPanelConfig = { }, }, ], + [minorTicks], ...legendSection, [{t('X Axis')}], ['x_axis_time_format'], 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 223083ef0c166..6c96ab7104a6e 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts @@ -160,6 +160,7 @@ export default function transformProps( opacity, opacityB, minorSplitLine, + minorTicks, seriesType, seriesTypeB, showLegend, @@ -499,6 +500,7 @@ export default function transformProps( formatter: xAxisFormatter, rotate: xAxisLabelRotation, }, + minorTick: { show: minorTicks }, minInterval: xAxisType === 'time' && timeGrainSqla ? TIMEGRAIN_TO_TIMESTAMP[timeGrainSqla] @@ -520,7 +522,7 @@ export default function transformProps( type: logAxis ? 'log' : 'value', min: yAxisMin, max: yAxisMax, - minorTick: { show: true }, + minorTick: { show: minorTicks }, minorSplitLine: { show: minorSplitLine }, axisLabel: { formatter: getYAxisFormatter( @@ -541,7 +543,7 @@ export default function transformProps( type: logAxisSecondary ? 'log' : 'value', min: minSecondary, max: maxSecondary, - minorTick: { show: true }, + minorTick: { show: minorTicks }, splitLine: { show: false }, minorSplitLine: { show: minorSplitLine }, axisLabel: { 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 2e9ba641aa5e5..c027ed7ac4ffc 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts @@ -45,6 +45,7 @@ export type EchartsMixedTimeseriesFormData = QueryFormData & { annotationLayers: AnnotationLayer[]; // shared properties minorSplitLine: boolean; + minorTicks: boolean; logAxis: boolean; logAxisSecondary: boolean; yAxisFormat?: string; diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx index 1ca2805b2f77a..2d8bf549aa3a4 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Area/controlPanel.tsx @@ -40,6 +40,7 @@ import { xAxisLabelRotation, truncateXAxis, xAxisBounds, + minorTicks, } from '../../controls'; import { AreaChartStackControlOptions } from '../../constants'; @@ -169,6 +170,7 @@ const config: ControlPanelConfig = { }, }, ], + [minorTicks], [ { name: 'zoomable', diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx index 1fecf64e6a87d..23cdae6a390d1 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Bar/controlPanel.tsx @@ -32,6 +32,7 @@ import { } from '@superset-ui/chart-controls'; import { legendSection, + minorTicks, richTooltipSection, seriesOrderSection, showValueSection, @@ -299,6 +300,7 @@ const config: ControlPanelConfig = { ...seriesOrderSection, ['color_scheme'], ...showValueSection, + [minorTicks], [ { name: 'zoomable', diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx index 488dac0738ee7..1b2e7688ea4b9 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Line/controlPanel.tsx @@ -35,6 +35,7 @@ import { } from '../../constants'; import { legendSection, + minorTicks, richTooltipSection, seriesOrderSection, showValueSection, @@ -169,6 +170,7 @@ const config: ControlPanelConfig = { }, }, ], + [minorTicks], ...legendSection, [{t('X Axis')}], [ diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx index 436000c62de26..334f4438c3141 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx @@ -34,6 +34,7 @@ import { } from '../../constants'; import { legendSection, + minorTicks, richTooltipSection, seriesOrderSection, showValueSection, @@ -111,6 +112,7 @@ const config: ControlPanelConfig = { }, }, ], + [minorTicks], ...legendSection, [{t('X Axis')}], diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx index 2e05ab8202059..24ff0bfa8dc5f 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/SmoothLine/controlPanel.tsx @@ -34,6 +34,7 @@ import { } from '../../constants'; import { legendSection, + minorTicks, richTooltipSection, seriesOrderSection, showValueSectionWithoutStack, @@ -111,6 +112,7 @@ const config: ControlPanelConfig = { }, }, ], + [minorTicks], ...legendSection, [{t('X Axis')}], [ diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx index 311b85cac0ead..36da829576864 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Step/controlPanel.tsx @@ -32,6 +32,7 @@ import { EchartsTimeseriesSeriesType } from '../../types'; import { DEFAULT_FORM_DATA, TIME_SERIES_DESCRIPTION_TEXT } from '../constants'; import { legendSection, + minorTicks, richTooltipSection, seriesOrderSection, showValueSection, @@ -163,6 +164,7 @@ const config: ControlPanelConfig = { }, }, ], + [minorTicks], ...legendSection, [{t('X Axis')}], [ diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts index 0d54fd114c92b..bbb624c0e0a1f 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts @@ -146,6 +146,7 @@ export default function transformProps( markerSize, metrics, minorSplitLine, + minorTicks, onlyTotal, opacity, orientation, @@ -456,6 +457,7 @@ export default function transformProps( formatter: xAxisFormatter, rotate: xAxisLabelRotation, }, + minorTick: { show: minorTicks }, minInterval: xAxisType === AxisType.time && timeGrainSqla ? TIMEGRAIN_TO_TIMESTAMP[timeGrainSqla] @@ -474,7 +476,7 @@ export default function transformProps( type: logAxis ? AxisType.log : AxisType.value, min: yAxisMin, max: yAxisMax, - minorTick: { show: true }, + minorTick: { show: minorTicks }, minorSplitLine: { show: minorSplitLine }, axisLabel: { formatter: getYAxisFormatter( diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts index 65da981e496a5..751f262ec1757 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts @@ -68,6 +68,7 @@ export type EchartsTimeseriesFormData = QueryFormData & { markerSize: number; metrics: QueryFormMetric[]; minorSplitLine: boolean; + minorTicks: boolean; opacity: number; orderDesc: boolean; rowLimit: number; diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx index 13fe754d99558..21f8c7d97dbd8 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx +++ b/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx @@ -298,3 +298,14 @@ export const xAxisBounds: ControlSetItem = { Boolean(controls?.truncateXAxis?.value), }, }; + +export const minorTicks: ControlSetItem = { + name: 'minorTicks', + config: { + type: 'CheckboxControl', + label: t('Minor ticks'), + default: false, + renderTrigger: true, + description: t('Show minor ticks on axes.'), + }, +};