You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by kr...@apache.org on 2019/03/19 21:26:35 UTC

[incubator-superset] branch lyftga updated: feat: add ability to change font size in big number (#7003)

This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/lyftga by this push:
     new 6d0c390  feat: add ability to change font size in big number (#7003)
6d0c390 is described below

commit 6d0c3906f54f5dc11e20ec444c47cb2919b94224
Author: Kim Truong <47...@users.noreply.github.com>
AuthorDate: Tue Mar 19 14:26:17 2019 -0700

    feat: add ability to change font size in big number (#7003)
    
    * Add ability to change font sizes in Big Number
    
    * rename big number to header
    
    * Add comment to clarify font size values
---
 superset/assets/backendSync.json                   | 58 ++++++++++++++++++++
 .../assets/src/explore/controlPanels/BigNumber.js  | 13 ++++-
 .../src/explore/controlPanels/BigNumberTotal.js    | 13 ++++-
 superset/assets/src/explore/controls.jsx           | 62 ++++++++++++++++++++++
 4 files changed, 144 insertions(+), 2 deletions(-)

diff --git a/superset/assets/backendSync.json b/superset/assets/backendSync.json
index 8008621..d334778 100644
--- a/superset/assets/backendSync.json
+++ b/superset/assets/backendSync.json
@@ -2493,6 +2493,64 @@
       "default": "150",
       "description": "Font size for the biggest value in the list"
     },
+    "header_font_size": {
+      "type": "SelectControl",
+      "label": "Header Font Size",
+      "renderTrigger": true,
+      "clearable": false,
+      "default": 0.3,
+      "options": [
+        {
+          "label": "Tiny",
+          "value": 0.125
+        },
+        {
+          "label": "Small",
+          "value": 0.2
+        },
+        {
+          "label": "Normal",
+          "value": 0.3
+        },
+        {
+          "label": "Large",
+          "value": 0.4
+        },
+        {
+          "label": "Huge",
+          "value": 0.5
+        }
+      ]
+    },
+    "subheader_font_size": {
+      "type": "SelectControl",
+      "label": "Subheader Font Size",
+      "renderTrigger": true,
+      "clearable": false,
+      "default": 0.125,
+      "options": [
+        {
+          "label": "Tiny",
+          "value": 0.125
+        },
+        {
+          "label": "Small",
+          "value": 0.2
+        },
+        {
+          "label": "Normal",
+          "value": 0.3
+        },
+        {
+          "label": "Large",
+          "value": 0.4
+        },
+        {
+          "label": "Huge",
+          "value": 0.5
+        }
+      ]
+    },
     "instant_filtering": {
       "type": "CheckboxControl",
       "label": "Instant Filtering",
diff --git a/superset/assets/src/explore/controlPanels/BigNumber.js b/superset/assets/src/explore/controlPanels/BigNumber.js
index b931c71..e621ee1 100644
--- a/superset/assets/src/explore/controlPanels/BigNumber.js
+++ b/superset/assets/src/explore/controlPanels/BigNumber.js
@@ -29,13 +29,21 @@ export default {
       ],
     },
     {
-      label: t('Chart Options'),
+      label: t('Options'),
       expanded: true,
       controlSetRows: [
         ['compare_lag', 'compare_suffix'],
         ['y_axis_format', null],
         ['show_trend_line', 'start_y_axis_at_zero'],
+      ],
+    },
+    {
+      label: t('Chart Options'),
+      expanded: true,
+      controlSetRows: [
         ['color_picker', null],
+        ['header_font_size'],
+        ['subheader_font_size'],
       ],
     },
   ],
@@ -43,5 +51,8 @@ export default {
     y_axis_format: {
       label: t('Number format'),
     },
+    header_font_size: {
+      label: t('Big Number Font Size'),
+    },
   },
 };
diff --git a/superset/assets/src/explore/controlPanels/BigNumberTotal.js b/superset/assets/src/explore/controlPanels/BigNumberTotal.js
index 22a7d69..7b3e730 100644
--- a/superset/assets/src/explore/controlPanels/BigNumberTotal.js
+++ b/superset/assets/src/explore/controlPanels/BigNumberTotal.js
@@ -29,17 +29,28 @@ export default {
       ],
     },
     {
-      label: t('Chart Options'),
+      label: t('Options'),
       expanded: true,
       controlSetRows: [
         ['subheader'],
         ['y_axis_format'],
       ],
     },
+    {
+      label: t('Chart Options'),
+      expanded: true,
+      controlSetRows: [
+        ['header_font_size'],
+        ['subheader_font_size'],
+      ],
+    },
   ],
   controlOverrides: {
     y_axis_format: {
       label: t('Number format'),
     },
+    header_font_size: {
+      label: t('Big Number Font Size'),
+    },
   },
 };
diff --git a/superset/assets/src/explore/controls.jsx b/superset/assets/src/explore/controls.jsx
index cb5909a..d50db9c 100644
--- a/superset/assets/src/explore/controls.jsx
+++ b/superset/assets/src/explore/controls.jsx
@@ -1399,6 +1399,68 @@ export const controls = {
     description: t('Font size for the biggest value in the list'),
   },
 
+  header_font_size: {
+    type: 'SelectControl',
+    label: t('Header Font Size'),
+    renderTrigger: true,
+    clearable: false,
+    default: 0.3,
+    // Values represent the percentage of space a header should take
+    options: [
+      {
+        label: t('Tiny'),
+        value: 0.125,
+      },
+      {
+        label: t('Small'),
+        value: 0.2,
+      },
+      {
+        label: t('Normal'),
+        value: 0.3,
+      },
+      {
+        label: t('Large'),
+        value: 0.4,
+      },
+      {
+        label: t('Huge'),
+        value: 0.5,
+      },
+    ],
+  },
+
+  subheader_font_size: {
+    type: 'SelectControl',
+    label: t('Subheader Font Size'),
+    renderTrigger: true,
+    clearable: false,
+    default: 0.125,
+    // Values represent the percentage of space a subheader should take
+    options: [
+      {
+        label: t('Tiny'),
+        value: 0.125,
+      },
+      {
+        label: t('Small'),
+        value: 0.2,
+      },
+      {
+        label: t('Normal'),
+        value: 0.3,
+      },
+      {
+        label: t('Large'),
+        value: 0.4,
+      },
+      {
+        label: t('Huge'),
+        value: 0.5,
+      },
+    ],
+  },
+
   instant_filtering: {
     type: 'CheckboxControl',
     label: t('Instant Filtering'),