Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating unique NVD3 controls (phase 1) #9407

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -1050,16 +1050,13 @@ The filter-box configuration references column names (via the `column` key) and
| Field | Type | Notes |
| --------------------- | --------- | ------------------------------------------------ |
| `color_picker` | _object_ | The **Fixed Color** widget |
| `donut` | _boolean_ | The **Donut** widget |
| `global_opacity` | _number_ | The **Opacity** widget |
| `header_font_size` | _number_ | The **Big Number Font Size** widget (or similar) |
| `label_colors` | _object_ | The **Color Scheme** widget |
| `labels_outside` | _boolean_ | The **Put labels outside** widget |
| `line_interpolation` | _string_ | The **Line Style** widget |
| `link_length` | _number_ | The **No of Bins** widget |
| `normalized` | _boolean_ | The **Normalized** widget |
| `number_format` | _string_ | The **Number format** widget |
| `pie_label_type` | _string_ | [HIDDEN] |
| `rich_tooltip` | _boolean_ | The **Rich Tooltip** widget |
| `send_time_range` | _boolean_ | The **Show Markers** widget |
| `show_brush` | _string_ | The **Show Range Filter** widget |
Expand All @@ -1075,7 +1072,6 @@ The filter-box configuration references column names (via the `column` key) and
| `x_axis_format` | _string_ | The **X Axis Format** widget |
| `x_axis_label` | _string_ | The **X Axis Label** widget |
| `x_axis_showminmax` | _boolean_ | The **X bounds** widget |
| `x_log_scale` | _N/A_ | _Deprecated?_ |
| `x_ticks_layout` | _string_ | The **X Tick Layout** widget |

### Y Axis
Expand Down Expand Up @@ -1144,21 +1140,14 @@ Note the `y_axis_format` is defined under various section for some charts.
| `js_agg_function` | _N/A_ | |
| `js_columns` | _N/A_ | |
| `label` | _N/A_ | |
| `labels_outside` | _N/A_ | |
| `legend_position` | _N/A_ | |
| `line_charts` | _N/A_ | |
| `line_charts_2` | _N/A_ | |
| `line_column` | _N/A_ | |
| `line_type` | _N/A_ | |
| `line_width` | _N/A_ | |
| `linear_color_scheme` | _N/A_ | |
| `log_scale` | _N/A_ | |
| `mapbox_label` | _N/A_ | |
| `mapbox_style` | _N/A_ | |
| `marker_labels` | _N/A_ | |
| `marker_line_labels` | _N/A_ | |
| `marker_lines` | _N/A_ | |
| `markers` | _N/A_ | |
| `markup_type` | _N/A_ | |
| `max_radius` | _N/A_ | |
| `min_periods` | _N/A_ | |
Expand All @@ -1176,9 +1165,6 @@ Note the `y_axis_format` is defined under various section for some charts.
| `perm` | _N/A_ | |
| `point_radius_fixed` | _N/A_ | |
| `point_unit` | _N/A_ | |
| `prefix_metric_with_slice_name` | _N/A_ | |
| `range_labels` | _N/A_ | |
| `ranges` | _N/A_ | |
| `rdo_save` | _N/A_ | |
| `reduce_x_ticks` | _N/A_ | |
| `refresh_frequency` | _N/A_ | |
Expand Down Expand Up @@ -1207,7 +1193,6 @@ Note the `y_axis_format` is defined under various section for some charts.
| `show_values` | _N/A_ | |
| `slice_name` | _N/A_ | |
| `spatial` | _N/A_ | |
| `stacked_style` | _N/A_ | |
| `start_spatial` | _N/A_ | |
| `stroke_color_picker` | _N/A_ | |
| `stroke_width` | _N/A_ | |
Expand Down
19 changes: 18 additions & 1 deletion superset-frontend/src/explore/controlPanels/Area.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,24 @@ export default {
expanded: true,
controlSetRows: [
['show_brush', 'show_legend'],
['line_interpolation', 'stacked_style'],
[
'line_interpolation',
{
name: 'stacked_style',
config: {
type: 'SelectControl',
label: t('Stacked Style'),
renderTrigger: true,
choices: [
['stack', 'stack'],
['stream', 'stream'],
['expand', 'expand'],
],
default: 'stack',
description: '',
},
},
],
['color_scheme', 'label_colors'],
['rich_tooltip', 'show_controls'],
],
Expand Down
59 changes: 56 additions & 3 deletions superset-frontend/src/explore/controlPanels/Bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/
import { t } from '@superset-ui/translation';
import { nonEmpty } from '../validators';

export default {
label: t('Bubble Chart'),
Expand All @@ -26,8 +27,48 @@ export default {
expanded: true,
controlSetRows: [
['series', 'entity'],
['x'],
['y'],
[
{
name: 'x',
config: {
type: 'MetricsControl',
validators: [nonEmpty],
mapStateToProps: state => {
const datasource = state.datasource;
return {
columns: datasource ? datasource.columns : [],
savedMetrics: datasource ? datasource.metrics : [],
datasourceType: datasource && datasource.type,
};
},
multi: false,
label: t('X Axis'),
description: t('Metric assigned to the [X] axis'),
default: null,
},
},
],
[
{
name: 'y',
config: {
type: 'MetricsControl',
validators: [nonEmpty],
mapStateToProps: state => {
const datasource = state.datasource;
return {
columns: datasource ? datasource.columns : [],
savedMetrics: datasource ? datasource.metrics : [],
datasourceType: datasource && datasource.type,
};
},
multi: false,
label: t('Y Axis'),
default: null,
description: t('Metric assigned to the [Y] axis'),
},
},
],
['adhoc_filters'],
['size'],
['max_bubble_size'],
Expand All @@ -48,7 +89,19 @@ export default {
controlSetRows: [
['x_axis_label', 'left_margin'],
['x_axis_format', 'x_ticks_layout'],
['x_log_scale', 'x_axis_showminmax'],
[
{
name: 'x_log_scale',
config: {
type: 'CheckboxControl',
label: t('X Log Scale'),
default: false,
renderTrigger: true,
description: t('Use a log scale for the X-axis'),
},
},
'x_axis_showminmax',
],
],
},
{
Expand Down
63 changes: 60 additions & 3 deletions superset-frontend/src/explore/controlPanels/Bullet.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,66 @@ export default {
label: t('Chart Options'),
expanded: true,
controlSetRows: [
['ranges', 'range_labels'],
['markers', 'marker_labels'],
['marker_lines', 'marker_line_labels'],
[
{
name: 'ranges',
config: {
type: 'TextControl',
label: t('Ranges'),
default: '',
description: t('Ranges to highlight with shading'),
},
},
{
name: 'range_labels',
config: {
type: 'TextControl',
label: t('Range labels'),
default: '',
description: t('Labels for the ranges'),
},
},
],
[
{
name: 'markers',
config: {
type: 'TextControl',
label: t('Markers'),
default: '',
description: t('List of values to mark with triangles'),
},
},
{
name: 'marker_labels',
config: {
type: 'TextControl',
label: t('Marker labels'),
default: '',
description: t('Labels for the markers'),
},
},
],
[
{
name: 'marker_lines',
config: {
type: 'TextControl',
label: t('Marker lines'),
default: '',
description: t('List of values to mark with lines'),
},
},
{
name: 'marker_line_labels',
config: {
type: 'TextControl',
label: t('Marker line labels'),
default: '',
description: t('Labels for the marker lines'),
},
},
],
],
},
],
Expand Down
28 changes: 27 additions & 1 deletion superset-frontend/src/explore/controlPanels/DualLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import { t } from '@superset-ui/translation';
import { annotations } from './sections';
import { D3_TIME_FORMAT_OPTIONS } from '../controls';
import { mainMetric } from '../../modules/utils';
import { nonEmpty } from '../validators';

export default {
requiresTime: true,
Expand All @@ -36,7 +38,31 @@ export default {
{
label: t('Y Axis 2'),
expanded: true,
controlSetRows: [['metric_2', 'y_axis_2_format']],
controlSetRows: [
[
{
name: 'metric_2',
config: {
type: 'MetricsControl',
validators: [nonEmpty],
mapStateToProps: state => {
const datasource = state.datasource;
return {
columns: datasource ? datasource.columns : [],
savedMetrics: datasource ? datasource.metrics : [],
datasourceType: datasource && datasource.type,
};
},
multi: false,
default: props => mainMetric(props.savedMetrics),
label: t('Right Axis Metric'),
clearable: true,
description: t('Choose a metric for right axis'),
},
},
'y_axis_2_format',
],
],
},
{
label: t('Query'),
Expand Down
78 changes: 71 additions & 7 deletions superset-frontend/src/explore/controlPanels/LineMulti.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import { t } from '@superset-ui/translation';
import { annotations } from './sections';
import { D3_TIME_FORMAT_OPTIONS } from '../controls';
import { nonEmpty } from '../validators';

export default {
requiresTime: true,
Expand All @@ -28,7 +29,18 @@ export default {
expanded: true,
controlSetRows: [
['color_scheme', 'label_colors'],
['prefix_metric_with_slice_name', null],
[
{
name: 'prefix_metric_with_slice_name',
config: {
type: 'CheckboxControl',
label: t('Prefix metric name with slice name'),
default: false,
renderTrigger: true,
},
},
null,
],
['show_legend', 'show_markers'],
['line_interpolation', null],
],
Expand All @@ -45,12 +57,68 @@ export default {
{
label: t('Y Axis 1'),
expanded: true,
controlSetRows: [['line_charts', 'y_axis_format']],
controlSetRows: [
[
{
name: 'line_charts',
config: {
type: 'SelectAsyncControl',
multi: true,
label: t('Left Axis chart(s)'),
validators: [nonEmpty],
default: [],
description: t('Choose one or more charts for left axis'),
dataEndpoint:
'/sliceasync/api/read?_flt_0_viz_type=line&_flt_7_viz_type=line_multi',
placeholder: t('Select charts'),
onAsyncErrorMessage: t('Error while fetching charts'),
mutator: data => {
if (!data || !data.result) {
return [];
}
return data.result.map(o => ({
value: o.id,
label: o.slice_name,
}));
},
},
},
'y_axis_format',
],
],
},
{
label: t('Y Axis 2'),
expanded: false,
controlSetRows: [['line_charts_2', 'y_axis_2_format']],
controlSetRows: [
[
{
name: 'line_charts_2',
config: {
type: 'SelectAsyncControl',
multi: true,
label: t('Right Axis chart(s)'),
validators: [],
default: [],
description: t('Choose one or more charts for right axis'),
dataEndpoint:
'/sliceasync/api/read?_flt_0_viz_type=line&_flt_7_viz_type=line_multi',
placeholder: t('Select charts'),
onAsyncErrorMessage: t('Error while fetching charts'),
mutator: data => {
if (!data || !data.result) {
return [];
}
return data.result.map(o => ({
value: o.id,
label: o.slice_name,
}));
},
},
},
'y_axis_2_format',
],
],
},
{
label: t('Query'),
Expand All @@ -60,10 +128,6 @@ export default {
annotations,
],
controlOverrides: {
line_charts: {
label: t('Left Axis chart(s)'),
description: t('Choose one or more charts for left axis'),
},
y_axis_format: {
label: t('Left Axis Format'),
},
Expand Down
Loading