Skip to content

Commit

Permalink
chore: Disables minor ticks by default (apache#26310)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina authored Dec 20, 2023
1 parent 8c32c6d commit eb65cea
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { DEFAULT_FORM_DATA } from './types';
import { EchartsTimeseriesSeriesType } from '../Timeseries/types';
import {
legendSection,
minorTicks,
richTooltipSection,
truncateXAxis,
xAxisBounds,
Expand Down Expand Up @@ -316,6 +317,7 @@ const config: ControlPanelConfig = {
},
},
],
[minorTicks],
...legendSection,
[<ControlSubSectionHeader>{t('X Axis')}</ControlSubSectionHeader>],
['x_axis_time_format'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export default function transformProps(
opacity,
opacityB,
minorSplitLine,
minorTicks,
seriesType,
seriesTypeB,
showLegend,
Expand Down Expand Up @@ -499,6 +500,7 @@ export default function transformProps(
formatter: xAxisFormatter,
rotate: xAxisLabelRotation,
},
minorTick: { show: minorTicks },
minInterval:
xAxisType === 'time' && timeGrainSqla
? TIMEGRAIN_TO_TIMESTAMP[timeGrainSqla]
Expand All @@ -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(
Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export type EchartsMixedTimeseriesFormData = QueryFormData & {
annotationLayers: AnnotationLayer[];
// shared properties
minorSplitLine: boolean;
minorTicks: boolean;
logAxis: boolean;
logAxisSecondary: boolean;
yAxisFormat?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
xAxisLabelRotation,
truncateXAxis,
xAxisBounds,
minorTicks,
} from '../../controls';
import { AreaChartStackControlOptions } from '../../constants';

Expand Down Expand Up @@ -169,6 +170,7 @@ const config: ControlPanelConfig = {
},
},
],
[minorTicks],
[
{
name: 'zoomable',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
} from '@superset-ui/chart-controls';
import {
legendSection,
minorTicks,
richTooltipSection,
seriesOrderSection,
showValueSection,
Expand Down Expand Up @@ -299,6 +300,7 @@ const config: ControlPanelConfig = {
...seriesOrderSection,
['color_scheme'],
...showValueSection,
[minorTicks],
[
{
name: 'zoomable',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
} from '../../constants';
import {
legendSection,
minorTicks,
richTooltipSection,
seriesOrderSection,
showValueSection,
Expand Down Expand Up @@ -169,6 +170,7 @@ const config: ControlPanelConfig = {
},
},
],
[minorTicks],
...legendSection,
[<ControlSubSectionHeader>{t('X Axis')}</ControlSubSectionHeader>],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
} from '../../constants';
import {
legendSection,
minorTicks,
richTooltipSection,
seriesOrderSection,
showValueSection,
Expand Down Expand Up @@ -111,6 +112,7 @@ const config: ControlPanelConfig = {
},
},
],
[minorTicks],
...legendSection,
[<ControlSubSectionHeader>{t('X Axis')}</ControlSubSectionHeader>],

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
} from '../../constants';
import {
legendSection,
minorTicks,
richTooltipSection,
seriesOrderSection,
showValueSectionWithoutStack,
Expand Down Expand Up @@ -111,6 +112,7 @@ const config: ControlPanelConfig = {
},
},
],
[minorTicks],
...legendSection,
[<ControlSubSectionHeader>{t('X Axis')}</ControlSubSectionHeader>],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { EchartsTimeseriesSeriesType } from '../../types';
import { DEFAULT_FORM_DATA, TIME_SERIES_DESCRIPTION_TEXT } from '../constants';
import {
legendSection,
minorTicks,
richTooltipSection,
seriesOrderSection,
showValueSection,
Expand Down Expand Up @@ -163,6 +164,7 @@ const config: ControlPanelConfig = {
},
},
],
[minorTicks],
...legendSection,
[<ControlSubSectionHeader>{t('X Axis')}</ControlSubSectionHeader>],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export default function transformProps(
markerSize,
metrics,
minorSplitLine,
minorTicks,
onlyTotal,
opacity,
orientation,
Expand Down Expand Up @@ -456,6 +457,7 @@ export default function transformProps(
formatter: xAxisFormatter,
rotate: xAxisLabelRotation,
},
minorTick: { show: minorTicks },
minInterval:
xAxisType === AxisType.time && timeGrainSqla
? TIMEGRAIN_TO_TIMESTAMP[timeGrainSqla]
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export type EchartsTimeseriesFormData = QueryFormData & {
markerSize: number;
metrics: QueryFormMetric[];
minorSplitLine: boolean;
minorTicks: boolean;
opacity: number;
orderDesc: boolean;
rowLimit: number;
Expand Down
11 changes: 11 additions & 0 deletions superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.'),
},
};

0 comments on commit eb65cea

Please sign in to comment.