Files
superset2/superset-frontend/src/explore/controlPanels/PivotTable.js
Evan Rusackas 5e4c291913 Controls cleanup pass (#9578)
* migrating date_filter

* normalized control

* filter_configs control

* column_collection control

* time_range_endpoints control

* time_range_fixed control

* url_params control

* cache_timeout control

* annotation_layers control

* color control unused?

* linters rule 🤘

* this should have been deleted earlier

* global_opacity, mapbox_label, mapbox_style, viewport_zoom

* linting

* comparison_type

* contribution control

* log_scale

* show_values

* table_filter

* pandas_aggfunc

* code control

* formatSelectOptions import

* lint

* markup_type control

* lintage

* date_time_format control, linting

* url control, test mods

* min_periods control

* rolling_periods

* rolling_type

* missing lib

* order_desc

* number_format

* link_length

* all_columns_y

* all_columns_x

* normalize_across, select_country, all_columns

* fixing test

* linter-caught dependencies

* waiting

* wait longer!

* utilizing tabOverride for Analytics

* tabOverride for Annotations and Layers
2020-04-24 16:12:26 -07:00

125 lines
3.6 KiB
JavaScript

/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { t } from '@superset-ui/translation';
import { formatSelectOptions } from '../../modules/utils';
import { D3_FORMAT_OPTIONS, D3_FORMAT_DOCS } from '../controls';
export default {
controlPanelSections: [
{
label: t('Query'),
expanded: true,
controlSetRows: [
['metrics'],
['adhoc_filters'],
['groupby'],
['columns'],
['row_limit', null],
],
},
{
label: t('Pivot Options'),
controlSetRows: [
[
{
name: 'pandas_aggfunc',
config: {
type: 'SelectControl',
label: t('Aggregation function'),
clearable: false,
choices: formatSelectOptions([
'sum',
'mean',
'min',
'max',
'std',
'var',
]),
default: 'sum',
description: t(
'Aggregate function to apply when pivoting and ' +
'computing the total rows and columns',
),
},
},
{
name: 'pivot_margins',
config: {
type: 'CheckboxControl',
label: t('Show totals'),
renderTrigger: false,
default: true,
description: t('Display total row/column'),
},
},
],
[
{
name: 'number_format',
config: {
type: 'SelectControl',
freeForm: true,
label: t('Number format'),
renderTrigger: true,
default: 'SMART_NUMBER',
choices: D3_FORMAT_OPTIONS,
description: D3_FORMAT_DOCS,
},
},
{
name: 'combine_metric',
config: {
type: 'CheckboxControl',
label: t('Combine Metrics'),
default: false,
description: t(
'Display metrics side by side within each column, as ' +
'opposed to each column being displayed side by side for each metric.',
),
},
},
],
[
{
name: 'transpose_pivot',
config: {
type: 'CheckboxControl',
label: t('Transpose Pivot'),
default: false,
description: t('Swap Groups and Columns'),
},
},
],
],
},
],
controlOverrides: {
groupby: { includeTime: true },
columns: { includeTime: true },
},
sectionOverrides: {
druidTimeSeries: {
controlSetRows: [['granularity', 'druid_time_origin'], ['time_range']],
},
sqlaTimeSeries: {
controlSetRows: [['granularity_sqla', 'time_grain_sqla'], ['time_range']],
},
},
};