superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: [pie] improvements to pie charts (#5236)
Date Thu, 12 Jul 2018 14:33:16 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new f9352af  [pie] improvements to pie charts (#5236)
f9352af is described below

commit f9352af80e81a075288c89c3bf2f8852215daade
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Thu Jul 12 10:33:11 2018 -0400

    [pie] improvements to pie charts (#5236)
    
    Pie chart was using `limit` instead of `row_limit` which didn't work.
    
    Also set a lower default limit to 25 to prevent the chart from getting
    super crowded.
    
    Unrelated drive-by fix of setting "percentage metric" to default to `[]`
---
 superset/assets/src/explore/controls.jsx       | 11 +++++++++++
 superset/assets/src/explore/visTypes.js        |  9 +++++++--
 superset/assets/src/visualizations/nvd3_vis.js |  1 +
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/superset/assets/src/explore/controls.jsx b/superset/assets/src/explore/controls.jsx
index 922b45c..9f5079c 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'),
     default: [],
     validators: [],
@@ -1449,6 +1450,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 e3b34e9..28f555e 100644
--- a/superset/assets/src/explore/visTypes.js
+++ b/superset/assets/src/explore/visTypes.js
@@ -142,7 +142,7 @@ export const visTypes = {
           ['metric'],
           ['adhoc_filters'],
           ['groupby'],
-          ['limit'],
+          ['row_limit'],
         ],
       },
       {
@@ -151,11 +151,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 4619d4d..e8f7e92 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')
{


Mime
View raw message