You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/04/08 15:43:56 UTC

[GitHub] [superset] stephenLYZ opened a new pull request, #19622: feat(plugin-chart-echarts): add aggregate total for the Pie/Donuct chart

stephenLYZ opened a new pull request, #19622:
URL: https://github.com/apache/superset/pull/19622

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   The data analyst would like to see the aggregate total to be displayed in a Pie/Donut chart. Similar to the Big Number chart. This will allow the viewer to see aggregate values as well as their breakdowns rather than having to calculate.
   This PR adds:
   - `show_total` control to decide whether to display the aggregate count.
   - total text will display at top of normal pie chart by default if `show_total` control checked
   - total text will display at center of donuct chart by default if `show_total` control checked
   - total text will adjust its own position according to the position of the legend.
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   ### control panel
   <img width="373" alt="image" src="https://user-images.githubusercontent.com/11830681/162456693-6048ab7f-0355-45f4-92d2-b6e057677b38.png">
   
   ### pie chart
   <img width="1827" alt="image" src="https://user-images.githubusercontent.com/11830681/162453884-4112fa41-3995-44dc-baa9-1b46566fa395.png">
   
   ### donuct chart
   <img width="1827" alt="image" src="https://user-images.githubusercontent.com/11830681/162453804-2cce62e6-ce15-4760-81b7-98d0bf34b9ba.png">
   
   ### with legend
   <img width="1827" alt="image" src="https://user-images.githubusercontent.com/11830681/162454032-f3c893bd-b286-4328-b13e-8aa7d7639f67.png">
   
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] zhaoyongjie commented on pull request #19622: feat(plugin-chart-echarts): add aggregate total for the Pie/Donuct chart

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on PR #19622:
URL: https://github.com/apache/superset/pull/19622#issuecomment-1094584822

   There is an unrelated issue when I tested this. The label of the Pie disappeared when I applied negative metrics.
   
   ![image](https://user-images.githubusercontent.com/2016594/162674163-4015e79f-f598-467f-87db-d1bf5a2de123.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro commented on a diff in pull request #19622: feat(plugin-chart-echarts): add aggregate total for the Pie/Donuct chart

Posted by GitBox <gi...@apache.org>.
villebro commented on code in PR #19622:
URL: https://github.com/apache/superset/pull/19622#discussion_r846974094


##########
superset-frontend/plugins/plugin-chart-echarts/src/Pie/transformProps.ts:
##########
@@ -248,6 +311,18 @@ export default function transformProps(
       ...getLegendProps(legendType, legendOrientation, showLegend),
       data: keys,
     },
+    graphic: showTotal
+      ? {
+          type: 'text',
+          ...getTotalValuePadding({ chartPadding, donut, width, height }),
+          style: {
+            text: t(`Total: ${numberFormatter(totalValue)}`),

Review Comment:
   Late to the party, but translated strings need to be constant. This needs to be something like:
   ```js
   t('Total: %s', numberFormatter(totalValue))
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas commented on pull request #19622: feat(plugin-chart-echarts): add aggregate total for the Pie/Donuct chart

Posted by GitBox <gi...@apache.org>.
rusackas commented on PR #19622:
URL: https://github.com/apache/superset/pull/19622#issuecomment-1093116774

   @stephenLYZ There's a TS error that needs addressing, but otherwise this is looking great!
   <img width="556" alt="image" src="https://user-images.githubusercontent.com/812905/162492273-e2afd05b-5d5a-4d8c-a148-af34d6a8ae39.png">
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #19622: feat(plugin-chart-echarts): add aggregate total for the Pie/Donuct chart

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #19622:
URL: https://github.com/apache/superset/pull/19622#issuecomment-1094256687

   # [Codecov](https://codecov.io/gh/apache/superset/pull/19622?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#19622](https://codecov.io/gh/apache/superset/pull/19622?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (59c92dc) into [master](https://codecov.io/gh/apache/superset/commit/1ad82af058ec79a544f48df7a1aa9b0a165ecfb8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1ad82af) will **decrease** coverage by `0.05%`.
   > The diff coverage is `21.05%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #19622      +/-   ##
   ==========================================
   - Coverage   66.53%   66.48%   -0.06%     
   ==========================================
     Files        1681     1681              
     Lines       64319    64389      +70     
     Branches     6564     6592      +28     
   ==========================================
   + Hits        42793    42807      +14     
   - Misses      19853    19899      +46     
   - Partials     1673     1683      +10     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | javascript | `51.15% <21.05%> (-0.07%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/19622?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...gins/plugin-chart-echarts/src/Pie/controlPanel.tsx](https://codecov.io/gh/apache/superset/pull/19622/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvUGllL2NvbnRyb2xQYW5lbC50c3g=) | `40.00% <ø> (ø)` | |
   | [...ins/plugin-chart-echarts/src/Pie/transformProps.ts](https://codecov.io/gh/apache/superset/pull/19622/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvUGllL3RyYW5zZm9ybVByb3BzLnRz) | `55.07% <21.05%> (-12.93%)` | :arrow_down: |
   | [...s/CRUD/data/database/DatabaseModal/ModalHeader.tsx](https://codecov.io/gh/apache/superset/pull/19622/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhYmFzZS9EYXRhYmFzZU1vZGFsL01vZGFsSGVhZGVyLnRzeA==) | `66.66% <0.00%> (-3.71%)` | :arrow_down: |
   | [...c/views/CRUD/data/database/DatabaseModal/index.tsx](https://codecov.io/gh/apache/superset/pull/19622/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhYmFzZS9EYXRhYmFzZU1vZGFsL2luZGV4LnRzeA==) | `31.80% <0.00%> (-1.00%)` | :arrow_down: |
   | [superset-frontend/src/components/Button/index.tsx](https://codecov.io/gh/apache/superset/pull/19622/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvQnV0dG9uL2luZGV4LnRzeA==) | `100.00% <0.00%> (ø)` | |
   | [superset-frontend/src/views/CRUD/hooks.ts](https://codecov.io/gh/apache/superset/pull/19622/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvaG9va3MudHM=) | `46.40% <0.00%> (+0.04%)` | :arrow_up: |
   | [...tend/src/views/CRUD/data/database/DatabaseList.tsx](https://codecov.io/gh/apache/superset/pull/19622/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhYmFzZS9EYXRhYmFzZUxpc3QudHN4) | `67.94% <0.00%> (+0.55%)` | :arrow_up: |
   | [...c/views/CRUD/data/database/DatabaseModal/styles.ts](https://codecov.io/gh/apache/superset/pull/19622/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvZGF0YS9kYXRhYmFzZS9EYXRhYmFzZU1vZGFsL3N0eWxlcy50cw==) | `76.69% <0.00%> (+0.69%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/19622?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/19622?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [1ad82af...59c92dc](https://codecov.io/gh/apache/superset/pull/19622?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] zhaoyongjie commented on pull request #19622: feat(plugin-chart-echarts): add aggregate total for the Pie/Donuct chart

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on PR #19622:
URL: https://github.com/apache/superset/pull/19622#issuecomment-1094579095

   I Tested in my local, and the behavior was expected.
   - [x] Apply integer metrics
   - [x] Apply float metrics
   - [x] Apply number formater
   
   ![image](https://user-images.githubusercontent.com/2016594/162672942-ff7caba3-91fd-40a7-9c52-51f57a22c794.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] zhaoyongjie merged pull request #19622: feat(plugin-chart-echarts): add aggregate total for the Pie/Donuct chart

Posted by GitBox <gi...@apache.org>.
zhaoyongjie merged PR #19622:
URL: https://github.com/apache/superset/pull/19622


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org