From 9fcdc93c06b3a93f43f2f18505fde23280eb55a7 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 26 Mar 2020 15:16:07 -0700 Subject: [PATCH] Migrating horizon controls (#9368) * migrating unique controls * linting :sparkles: --- CONTRIBUTING.md | 2 - .../src/explore/controlPanels/Horizon.js | 44 ++++++++++++++++++- superset-frontend/src/explore/controls.jsx | 34 -------------- 3 files changed, 43 insertions(+), 37 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index efe811f489da3..346c1071270a4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1119,7 +1119,6 @@ Note the `y_axis_format` is defined under various section for some charts. | `flt_op_1` | _N/A_ | | | `goto_dash` | _N/A_ | | | `grid_size` | _N/A_ | | -| `horizon_color_scale` | _N/A_ | | | `import_time` | _N/A_ | | | `instant_filtering` | _N/A_ | | | `js_agg_function` | _N/A_ | | @@ -1182,7 +1181,6 @@ Note the `y_axis_format` is defined under various section for some charts. | `schema` | _N/A_ | | | `select_country` | _N/A_ | | | `series` | _N/A_ | | -| `series_height` | _N/A_ | | | `show_bar_value` | _N/A_ | | | `show_brush` | _N/A_ | | | `show_bubbles` | _N/A_ | | diff --git a/superset-frontend/src/explore/controlPanels/Horizon.js b/superset-frontend/src/explore/controlPanels/Horizon.js index 244980e411a94..983ac9de117e8 100644 --- a/superset-frontend/src/explore/controlPanels/Horizon.js +++ b/superset-frontend/src/explore/controlPanels/Horizon.js @@ -18,6 +18,7 @@ */ import { t } from '@superset-ui/translation'; import { NVD3TimeSeries } from './sections'; +import { formatSelectOptions } from '../../modules/utils'; export default { controlPanelSections: [ @@ -25,7 +26,48 @@ export default { { label: t('Chart Options'), expanded: true, - controlSetRows: [['series_height', 'horizon_color_scale']], + controlSetRows: [ + [ + { + name: 'series_height', + config: { + type: 'SelectControl', + renderTrigger: true, + freeForm: true, + label: t('Series Height'), + default: '25', + choices: formatSelectOptions([ + '10', + '25', + '40', + '50', + '75', + '100', + '150', + '200', + ]), + description: t('Pixel height of each series'), + }, + }, + { + name: 'horizon_color_scale', + config: { + type: 'SelectControl', + renderTrigger: true, + label: t('Value Domain'), + choices: [ + ['series', 'series'], + ['overall', 'overall'], + ['change', 'change'], + ], + default: 'series', + description: t( + 'series: Treat each series independently; overall: All series use the same scale; change: Show changes compared to the first data point in each series', + ), + }, + }, + ], + ], }, ], }; diff --git a/superset-frontend/src/explore/controls.jsx b/superset-frontend/src/explore/controls.jsx index 020b3ccc785b8..0e84cd6697eef 100644 --- a/superset-frontend/src/explore/controls.jsx +++ b/superset-frontend/src/explore/controls.jsx @@ -381,21 +381,6 @@ export const controls = { ), }, - horizon_color_scale: { - type: 'SelectControl', - renderTrigger: true, - label: t('Value Domain'), - choices: [ - ['series', 'series'], - ['overall', 'overall'], - ['change', 'change'], - ], - default: 'series', - description: t( - 'series: Treat each series independently; overall: All series use the same scale; change: Show changes compared to the first data point in each series', - ), - }, - autozoom: { type: 'CheckboxControl', label: t('Auto Zoom'), @@ -1065,25 +1050,6 @@ export const controls = { description: t('Suffix to apply after the percentage display'), }, - series_height: { - type: 'SelectControl', - renderTrigger: true, - freeForm: true, - label: t('Series Height'), - default: '25', - choices: formatSelectOptions([ - '10', - '25', - '40', - '50', - '75', - '100', - '150', - '200', - ]), - description: t('Pixel height of each series'), - }, - x_axis_format: { type: 'SelectControl', freeForm: true,