This repository has been archived by the owner on Dec 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 271
feat(legacy-plugin-chart-nvd3): add control panels #469
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
plugins/legacy-preset-chart-nvd3/src/Area/controlPanel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/** | ||
* 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 { sections } from '@superset-ui/control-utils'; | ||
import { | ||
lineInterpolation, | ||
showBrush, | ||
showLegend, | ||
showControls, | ||
xAxisLabel, | ||
bottomMargin, | ||
xTicksLayout, | ||
xAxisFormat, | ||
yLogScale, | ||
yAxisBounds, | ||
xAxisShowMinmax, | ||
richTooltip, | ||
timeSeriesSection, | ||
} from '../NVD3Controls'; | ||
|
||
export default { | ||
requiresTime: true, | ||
controlPanelSections: [ | ||
timeSeriesSection[0], | ||
{ | ||
label: t('Chart Options'), | ||
expanded: true, | ||
controlSetRows: [ | ||
[showBrush, showLegend], | ||
[ | ||
lineInterpolation, | ||
{ | ||
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'], | ||
[richTooltip, showControls], | ||
], | ||
}, | ||
{ | ||
label: t('X Axis'), | ||
expanded: true, | ||
controlSetRows: [ | ||
[xAxisLabel, bottomMargin], | ||
[xTicksLayout, xAxisFormat], | ||
[xAxisShowMinmax, null], | ||
], | ||
}, | ||
{ | ||
label: t('Y Axis'), | ||
expanded: true, | ||
controlSetRows: [ | ||
['y_axis_format', yAxisBounds], | ||
[yLogScale, null], | ||
], | ||
}, | ||
timeSeriesSection[1], | ||
sections.annotations, | ||
], | ||
controlOverrides: { | ||
color_scheme: { | ||
renderTrigger: false, | ||
}, | ||
}, | ||
sectionOverrides: { | ||
druidTimeSeries: { | ||
controlSetRows: [['granularity', 'druid_time_origin'], ['time_range']], | ||
}, | ||
sqlaTimeSeries: { | ||
controlSetRows: [['granularity_sqla', 'time_grain_sqla'], ['time_range']], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** | ||
* 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 { sections } from '@superset-ui/control-utils'; | ||
import { | ||
lineInterpolation, | ||
showBrush, | ||
showLegend, | ||
showControls, | ||
xAxisLabel, | ||
yAxisLabel, | ||
bottomMargin, | ||
xTicksLayout, | ||
xAxisFormat, | ||
yLogScale, | ||
yAxisBounds, | ||
xAxisShowMinmax, | ||
yAxisShowMinmax, | ||
richTooltip, | ||
showBarValue, | ||
barStacked, | ||
reduceXTicks, | ||
leftMargin, | ||
timeSeriesSection, | ||
} from '../NVD3Controls'; | ||
|
||
export default { | ||
requiresTime: true, | ||
controlPanelSections: [ | ||
timeSeriesSection[0], | ||
{ | ||
label: t('Chart Options'), | ||
expanded: true, | ||
controlSetRows: [ | ||
['color_scheme', 'label_colors'], | ||
[showBrush, showLegend, showBarValue], | ||
[richTooltip, barStacked], | ||
[lineInterpolation, showControls], | ||
[bottomMargin], | ||
], | ||
}, | ||
{ | ||
label: t('X Axis'), | ||
expanded: true, | ||
controlSetRows: [ | ||
[xAxisLabel, bottomMargin], | ||
[xTicksLayout, xAxisFormat], | ||
[xAxisShowMinmax, reduceXTicks], | ||
], | ||
}, | ||
{ | ||
label: t('Y Axis'), | ||
expanded: true, | ||
controlSetRows: [ | ||
[yAxisLabel, leftMargin], | ||
[yAxisShowMinmax, yLogScale], | ||
['y_axis_format', yAxisBounds], | ||
], | ||
}, | ||
timeSeriesSection[1], | ||
sections.annotations, | ||
], | ||
sectionOverrides: { | ||
druidTimeSeries: { | ||
controlSetRows: [['granularity', 'druid_time_origin'], ['time_range']], | ||
}, | ||
sqlaTimeSeries: { | ||
controlSetRows: [['granularity_sqla', 'time_grain_sqla'], ['time_range']], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
plugins/legacy-preset-chart-nvd3/src/Bubble/controlPanel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/** | ||
* 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 { D3_FORMAT_OPTIONS, formatSelectOptions } from '@superset-ui/control-utils'; | ||
import { | ||
showLegend, | ||
xAxisLabel, | ||
yAxisLabel, | ||
bottomMargin, | ||
xTicksLayout, | ||
xAxisFormat, | ||
yLogScale, | ||
xAxisShowMinmax, | ||
yAxisShowMinmax, | ||
leftMargin, | ||
} from '../NVD3Controls'; | ||
|
||
export default { | ||
label: t('Bubble Chart'), | ||
controlPanelSections: [ | ||
{ | ||
label: t('Query'), | ||
expanded: true, | ||
controlSetRows: [ | ||
['series', 'entity'], | ||
['x'], | ||
['y'], | ||
['adhoc_filters'], | ||
['size'], | ||
[ | ||
{ | ||
name: 'max_bubble_size', | ||
config: { | ||
type: 'SelectControl', | ||
freeForm: true, | ||
label: t('Max Bubble Size'), | ||
default: '25', | ||
choices: formatSelectOptions(['5', '10', '15', '25', '50', '75', '100']), | ||
}, | ||
}, | ||
], | ||
['limit', null], | ||
], | ||
}, | ||
{ | ||
label: t('Chart Options'), | ||
expanded: true, | ||
controlSetRows: [ | ||
['color_scheme', 'label_colors'], | ||
[showLegend, null], | ||
], | ||
}, | ||
{ | ||
label: t('X Axis'), | ||
expanded: true, | ||
controlSetRows: [ | ||
[xAxisLabel, leftMargin], | ||
[ | ||
{ | ||
name: xAxisFormat.name, | ||
config: { | ||
...xAxisFormat.config, | ||
default: 'SMART_NUMBER', | ||
choices: D3_FORMAT_OPTIONS, | ||
}, | ||
}, | ||
xTicksLayout, | ||
], | ||
[ | ||
{ | ||
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'), | ||
}, | ||
}, | ||
xAxisShowMinmax, | ||
], | ||
], | ||
}, | ||
{ | ||
label: t('Y Axis'), | ||
expanded: true, | ||
controlSetRows: [ | ||
[yAxisLabel, bottomMargin], | ||
['y_axis_format', null], | ||
[yLogScale, yAxisShowMinmax], | ||
], | ||
}, | ||
], | ||
controlOverrides: { | ||
color_scheme: { | ||
renderTrigger: false, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we apply these overrides in-place instead of having this section here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a good idea, but for now I'm just trying to move the control panels while keeping them as intact as possible to minimize the chance of breaking things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kristw I'm making an internal JIRA ticket to track this, and we can go through and audit and remove (where possible) all
controlOverrides
. If you think it's safe enough, we can then consider removing the code that enables them, as well. We'll discuss further with you :)