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 DeckGL controls #9446

Merged
merged 1 commit into from
Apr 2, 2020
Merged
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
7 changes: 0 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,6 @@ Note the `y_axis_format` is defined under various section for some charts.
| `contribution` | _N/A_ | |
| `country_fieldtype` | _N/A_ | |
| `date_filter` | _N/A_ | |
| `deck_slices` | _N/A_ | |
| `default_filters` | _N/A_ | |
| `dimension` | _N/A_ | |
| `end_spatial` | _N/A_ | |
Expand All @@ -1141,7 +1140,6 @@ Note the `y_axis_format` is defined under various section for some charts.
| `grid_size` | _N/A_ | |
| `import_time` | _N/A_ | |
| `instant_filtering` | _N/A_ | |
| `js_agg_function` | _N/A_ | |
| `js_columns` | _N/A_ | |
| `label` | _N/A_ | |
| `labels_outside` | _N/A_ | |
Expand All @@ -1160,22 +1158,18 @@ Note the `y_axis_format` is defined under various section for some charts.
| `marker_lines` | _N/A_ | |
| `markers` | _N/A_ | |
| `markup_type` | _N/A_ | |
| `max_radius` | _N/A_ | |
| `min_periods` | _N/A_ | |
| `min_radius` | _N/A_ | |
| `multiplier` | _N/A_ | |
| `new_dashboard_name` | _N/A_ | |
| `new_slice_name` | _N/A_ | |
| `normalize_across` | _N/A_ | |
| `num_buckets` | _N/A_ | |
| `num_period_compare` | _N/A_ | |
| `order_bars` | _N/A_ | |
| `order_desc` | _N/A_ | |
| `pandas_aggfunc` | _N/A_ | |
| `period_ratio_type` | _N/A_ | |
| `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_ | |
Expand Down Expand Up @@ -1216,7 +1210,6 @@ Note the `y_axis_format` is defined under various section for some charts.
| `table_filter` | _N/A_ | |
| `time_compare` | _N/A_ | |
| `timed_refresh_immune_slices` | _N/A_ | |
| `toggle_polygons` | _N/A_ | |
| `url` | _N/A_ | |
| `userid` | _N/A_ | |
| `viewport` | _N/A_ | |
Expand Down
34 changes: 32 additions & 2 deletions superset-frontend/src/explore/controlPanels/DeckGeojson.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
* under the License.
*/
import { t } from '@superset-ui/translation';
import { nonEmpty, integer } from '../validators';
import { formatSelectOptions } from '../../modules/utils';
import { columnChoices } from '../controls';

export default {
requiresTime: true,
Expand All @@ -25,7 +28,21 @@ export default {
label: t('Query'),
expanded: true,
controlSetRows: [
['geojson', null],
[
{
name: 'geojson',
config: {
type: 'SelectControl',
label: t('GeoJson Column'),
validators: [nonEmpty],
description: t('Select the geojson column'),
mapStateToProps: state => ({
choices: columnChoices(state.datasource),
}),
},
},
null,
],
['row_limit', 'filter_nulls'],
['adhoc_filters'],
],
Expand All @@ -43,7 +60,20 @@ export default {
['fill_color_picker', 'stroke_color_picker'],
['filled', 'stroked'],
['extruded', null],
['point_radius_scale', null],
[
{
name: 'point_radius_scale',
config: {
type: 'SelectControl',
freeForm: true,
label: t('Point Radius Scale'),
validators: [integer],
default: null,
choices: formatSelectOptions([0, 100, 200, 300, 500]),
},
},
null,
],
],
},
{
Expand Down
35 changes: 34 additions & 1 deletion superset-frontend/src/explore/controlPanels/DeckHex.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
* under the License.
*/
import { t } from '@superset-ui/translation';
import {
formatSelectOptions,
formatSelectOptionsForRange,
} from '../../modules/utils';

export default {
requiresTime: true,
Expand All @@ -36,7 +40,36 @@ export default {
['mapbox_style', 'viewport'],
['color_picker', 'autozoom'],
['grid_size', 'extruded'],
['js_agg_function', null],
[
{
name: 'js_agg_function',
config: {
type: 'SelectControl',
label: t('Dynamic Aggregation Function'),
description: t(
'The function to use when aggregating points into groups',
),
default: 'sum',
clearable: false,
renderTrigger: true,
choices: formatSelectOptions([
'sum',
'min',
'max',
'mean',
'median',
'count',
'variance',
'deviation',
'p1',
'p5',
'p95',
'p99',
]),
},
},
null,
],
],
},
{
Expand Down
31 changes: 30 additions & 1 deletion superset-frontend/src/explore/controlPanels/DeckMulti.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 {
requiresTime: true,
Expand All @@ -26,7 +27,35 @@ export default {
expanded: true,
controlSetRows: [
['mapbox_style', 'viewport'],
['deck_slices', null],
[
{
name: 'deck_slices',
config: {
type: 'SelectAsyncControl',
multi: true,
label: t('deck.gl charts'),
validators: [nonEmpty],
default: [],
description: t(
'Pick a set of deck.gl charts to layer on top of one another',
),
dataEndpoint:
'/sliceasync/api/read?_flt_0_viz_type=deck_&_flt_7_viz_type=deck_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,
}));
},
},
},
null,
],
],
},
{
Expand Down
64 changes: 61 additions & 3 deletions superset-frontend/src/explore/controlPanels/DeckPolygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
import { t } from '@superset-ui/translation';
import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides';
import { formatSelectOptions } from '../../modules/utils';

export default {
requiresTime: true,
Expand Down Expand Up @@ -49,9 +50,66 @@ export default {
['filled', 'stroked'],
['extruded', 'multiplier'],
['line_width', null],
['linear_color_scheme', 'opacity'],
['num_buckets', 'break_points'],
['table_filter', 'toggle_polygons'],
[
'linear_color_scheme',
{
name: 'opacity',
config: {
type: 'SliderControl',
label: t('Opacity'),
default: 80,
step: 1,
min: 0,
max: 100,
renderTrigger: true,
description: t('Opacity, expects values between 0 and 100'),
},
},
],
[
{
name: 'num_buckets',
config: {
type: 'SelectControl',
multi: false,
freeForm: true,
label: t('Number of buckets to group data'),
default: 5,
choices: formatSelectOptions([2, 3, 5, 10]),
description: t('How many buckets should the data be grouped in.'),
renderTrigger: true,
},
},
{
name: 'break_points',
config: {
type: 'SelectControl',
multi: true,
freeForm: true,
label: t('Bucket break points'),
choices: formatSelectOptions([]),
description: t(
'List of n+1 values for bucketing metric into n buckets.',
),
renderTrigger: true,
},
},
],
[
'table_filter',
{
name: 'toggle_polygons',
config: {
type: 'CheckboxControl',
label: t('Multiple filtering'),
renderTrigger: true,
default: true,
description: t(
'Allow sending multiple polygons as a filter event',
),
},
},
],
['legend_position', 'legend_format'],
],
},
Expand Down
58 changes: 56 additions & 2 deletions superset-frontend/src/explore/controlPanels/DeckScatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
import { t } from '@superset-ui/translation';
import timeGrainSqlaAnimationOverrides from './timeGrainSqlaAnimationOverrides';
import { nonEmpty } from '../validators';

export default {
requiresTime: true,
Expand Down Expand Up @@ -53,8 +54,61 @@ export default {
{
label: t('Point Size'),
controlSetRows: [
['point_radius_fixed', 'point_unit'],
['min_radius', 'max_radius'],
[
'point_radius_fixed',
{
name: 'point_unit',
config: {
type: 'SelectControl',
label: t('Point Unit'),
default: 'square_m',
clearable: false,
choices: [
['square_m', 'Square meters'],
['square_km', 'Square kilometers'],
['square_miles', 'Square miles'],
['radius_m', 'Radius in meters'],
['radius_km', 'Radius in kilometers'],
['radius_miles', 'Radius in miles'],
],
description: t(
'The unit of measure for the specified point radius',
),
},
},
],
[
{
name: 'min_radius',
config: {
type: 'TextControl',
label: t('Minimum Radius'),
isFloat: true,
validators: [nonEmpty],
renderTrigger: true,
default: 2,
description: t(
'Minimum radius size of the circle, in pixels. As the zoom level changes, this ' +
'insures that the circle respects this minimum radius.',
),
},
},
{
name: 'max_radius',
config: {
type: 'TextControl',
label: t('Maximum Radius'),
isFloat: true,
validators: [nonEmpty],
renderTrigger: true,
default: 250,
description: t(
'Maxium radius size of the circle, in pixels. As the zoom level changes, this ' +
'insures that the circle respects this maximum radius.',
),
},
},
],
['multiplier', null],
],
},
Expand Down
Loading