Skip to content

Commit

Permalink
chore(plugin-chart-echarts): add types to controls
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Jan 16, 2022
1 parent e53a50a commit 19c7286
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import React from 'react';
import { t } from '@superset-ui/core';
import {
ControlPanelsContainerProps,
ControlSetItem,
ControlSetRow,
sharedControls,
} from '@superset-ui/chart-controls';
Expand All @@ -29,7 +30,7 @@ import { DEFAULT_FORM_DATA } from './Timeseries/types';
const { legendMargin, legendOrientation, legendType, showLegend } =
DEFAULT_LEGEND_FORM_DATA;

const showLegendControl = {
const showLegendControl: ControlSetItem = {
name: 'show_legend',
config: {
type: 'CheckboxControl',
Expand All @@ -40,7 +41,7 @@ const showLegendControl = {
},
};

const legendMarginControl = {
const legendMarginControl: ControlSetItem = {
name: 'legendMargin',
config: {
type: 'TextControl',
Expand All @@ -54,7 +55,7 @@ const legendMarginControl = {
},
};

const legendTypeControl = {
const legendTypeControl: ControlSetItem = {
name: 'legendType',
config: {
type: 'SelectControl',
Expand All @@ -72,7 +73,7 @@ const legendTypeControl = {
},
};

const legendOrientationControl = {
const legendOrientationControl: ControlSetItem = {
name: 'legendOrientation',
config: {
type: 'SelectControl',
Expand All @@ -92,15 +93,15 @@ const legendOrientationControl = {
},
};

export const legendSection = [
export const legendSection: ControlSetRow[] = [
[<h1 className="section-header">{t('Legend')}</h1>],
[showLegendControl],
[legendTypeControl],
[legendOrientationControl],
[legendMarginControl],
];

const showValueControl = {
const showValueControl: ControlSetItem = {
name: 'show_value',
config: {
type: 'CheckboxControl',
Expand All @@ -111,7 +112,7 @@ const showValueControl = {
},
};

const stackControl = {
const stackControl: ControlSetItem = {
name: 'stack',
config: {
type: 'CheckboxControl',
Expand All @@ -122,7 +123,7 @@ const stackControl = {
},
};

const onlyTotalControl = {
const onlyTotalControl: ControlSetItem = {
name: 'only_total',
config: {
type: 'CheckboxControl',
Expand All @@ -137,7 +138,7 @@ const onlyTotalControl = {
},
};

const percentageThresholdControl = {
const percentageThresholdControl: ControlSetItem = {
name: 'percentage_threshold',
config: {
type: 'TextControl',
Expand All @@ -155,14 +156,14 @@ const percentageThresholdControl = {
},
};

export const showValueSection = [
export const showValueSection: ControlSetRow[] = [
[showValueControl],
[stackControl],
[onlyTotalControl],
[percentageThresholdControl],
];

const richTooltipControl = {
const richTooltipControl: ControlSetItem = {
name: 'rich_tooltip',
config: {
type: 'CheckboxControl',
Expand All @@ -175,7 +176,7 @@ const richTooltipControl = {
},
};

const tooltipTimeFormatControl = {
const tooltipTimeFormatControl: ControlSetItem = {
name: 'tooltipTimeFormat',
config: {
...sharedControls.x_axis_time_format,
Expand All @@ -185,7 +186,7 @@ const tooltipTimeFormatControl = {
},
};

const tooltipSortByMetricControl = {
const tooltipSortByMetricControl: ControlSetItem = {
name: 'tooltipSortByMetric',
config: {
type: 'CheckboxControl',
Expand Down

0 comments on commit 19c7286

Please sign in to comment.