mistercrunch closed pull request #5236: [pie] improvements to pie charts URL: https://github.com/apache/incubator-superset/pull/5236
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/superset/assets/src/explore/controls.jsx b/superset/assets/src/explore/controls.jsx index d5ee702fb4..f3b6a909d5 100644 --- a/superset/assets/src/explore/controls.jsx +++ b/superset/assets/src/explore/controls.jsx @@ -206,6 +206,7 @@ export const controls = { percent_metrics: { ...metrics, multi: true, + default: [], label: t('Percentage Metrics'), validators: [], description: t('Metrics for which percentage of total are to be displayed'), @@ -1474,6 +1475,16 @@ export const controls = { description: t('Whether to display the legend (toggles)'), }, + show_labels: { + type: 'CheckboxControl', + label: t('Show Labels'), + renderTrigger: true, + default: true, + description: t( + 'Whether to display the labels. Note that the label only displays when the the 5% ' + + 'threshold.'), + }, + show_values: { type: 'CheckboxControl', label: t('Show Values'), diff --git a/superset/assets/src/explore/visTypes.js b/superset/assets/src/explore/visTypes.js index f771c38ad7..c12bc93286 100644 --- a/superset/assets/src/explore/visTypes.js +++ b/superset/assets/src/explore/visTypes.js @@ -164,7 +164,7 @@ export const visTypes = { ['metric'], ['adhoc_filters'], ['groupby'], - ['limit'], + ['row_limit'], ], }, { @@ -173,11 +173,16 @@ export const visTypes = { controlSetRows: [ ['pie_label_type'], ['donut', 'show_legend'], - ['labels_outside'], + ['show_labels', 'labels_outside'], ['color_scheme'], ], }, ], + controlOverrides: { + row_limit: { + default: 25, + }, + }, }, line: { diff --git a/superset/assets/src/visualizations/nvd3_vis.js b/superset/assets/src/visualizations/nvd3_vis.js index e94e74012b..dccd50ce72 100644 --- a/superset/assets/src/visualizations/nvd3_vis.js +++ b/superset/assets/src/visualizations/nvd3_vis.js @@ -272,6 +272,7 @@ export default function nvd3Vis(slice, payload) { if (fd.donut) { chart.donut(true); } + chart.showLabels(fd.show_labels); chart.labelsOutside(fd.labels_outside); chart.labelThreshold(0.05); // Configure the minimum slice size for labels to show up if (fd.pie_label_type !== 'key_percent' && fd.pie_label_type !== 'key_value') { ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org