You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "guoyunhe (via GitHub)" <gi...@apache.org> on 2023/05/12 07:57:06 UTC

[GitHub] [echarts] guoyunhe opened a new issue, #18618: [Feature] Stack bar chart show total

guoyunhe opened a new issue, #18618:
URL: https://github.com/apache/echarts/issues/18618

   ### What problem does this feature solve?
   
   How to add total/summary of a stack bar chart like this?
   
   ![image](https://github.com/apache/echarts/assets/5836790/2a0e2fbd-ce47-4fc2-a4d6-2df8bf956332)
   
   
   ### What does the proposed API look like?
   
   thanks!


-- 
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: commits-unsubscribe@echarts.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] guoyunhe commented on issue #18618: [Feature] Stack bar chart show total

Posted by "guoyunhe (via GitHub)" <gi...@apache.org>.
guoyunhe commented on issue #18618:
URL: https://github.com/apache/echarts/issues/18618#issuecomment-1547107101

   OK, here is my solution based on @helgasoft 's demo.
   
   First, I prepend `0.0000` to the summary value and convert the value to string. It seems like a 0 size stack.
   
   ```js
   {
     series: [
       // ...
       {
         name: 'Total',
         // ...
         data: data.map((item) => `0.0000${item.sum}`),
       },
     ],
   }
   ```
   
   Then, in the tooltip config, I will detect if the value is string. If it is string, I strip the `0.0000` before render the value:
   
   ```js
   {
     tooltip: {
       valueFormatter: v => typeof v === 'string' ? v.substring(6) : v,
     }
   }
   ```
   


-- 
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: commits-unsubscribe@echarts.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] guoyunhe commented on issue #18618: [Feature] Stack bar chart show total

Posted by "guoyunhe (via GitHub)" <gi...@apache.org>.
guoyunhe commented on issue #18618:
URL: https://github.com/apache/echarts/issues/18618#issuecomment-1546498854

   Thanks @helgasoft !


-- 
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: commits-unsubscribe@echarts.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] guoyunhe closed issue #18618: [Feature] Stack bar chart show total

Posted by "guoyunhe (via GitHub)" <gi...@apache.org>.
guoyunhe closed issue #18618: [Feature] Stack bar chart show total
URL: https://github.com/apache/echarts/issues/18618


-- 
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: commits-unsubscribe@echarts.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] guoyunhe commented on issue #18618: [Feature] Stack bar chart show total

Posted by "guoyunhe (via GitHub)" <gi...@apache.org>.
guoyunhe commented on issue #18618:
URL: https://github.com/apache/echarts/issues/18618#issuecomment-1546526198

   @helgasoft a small issue with tooltip: how could I modify the last empty entry? Ideally, it should show "Total: 2250"
   ![image](https://github.com/apache/echarts/assets/5836790/c25d63f0-e503-429a-8653-25fe58ffd25e)
   


-- 
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: commits-unsubscribe@echarts.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] guoyunhe closed issue #18618: [Feature] Stack bar chart show total

Posted by "guoyunhe (via GitHub)" <gi...@apache.org>.
guoyunhe closed issue #18618: [Feature] Stack bar chart show total
URL: https://github.com/apache/echarts/issues/18618


-- 
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: commits-unsubscribe@echarts.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] helgasoft commented on issue #18618: [Feature] Stack bar chart show total

Posted by "helgasoft (via GitHub)" <gi...@apache.org>.
helgasoft commented on issue #18618:
URL: https://github.com/apache/echarts/issues/18618#issuecomment-1546143920

   [Demo Code](https://echarts.apache.org/examples/en/editor.html?c=bar-y-category-stack&code=PYBwLglsB2AEC8sDeAoWszGAG0iAXMmuhgE4QDmFApqYQOQCGAHhAM70A0x6L7ACsAjQwtQqhIkA9FNgBVNtVh82GYGUo1SanHh4kwATxDUGbABaMAJsADu9WDNj0L1uw8aqr1AGaMArrgA3LAAxoxwjNhs6gBGSvTYwtQOwNouljb2-gC-xDnc6NjUNNBW4gXEFOTlRJLFPmAMAMwApFz65BTmTc4ALO2FJLHAYJgAti2D-qEwYIzCADKM8diEYKT-1PlDzACCrGzi-kYmDABuUVv0O8SGB-zHkqemzuGiFGmGHZJWjPOEADa9AAsjAuM4ACrXTjOADq1CsEPokPM_mRADFyMiAMr_XH-aD0AC6t3QinI1COsEB-gkklg0EY41e9AAIhBSNRQmAfgyXgxYoxSHzJGx5qEANYMTDzbCikjYFbUNZ1Bnk8x2dabbbqyrq6jjECWNiPNXqnzAUL-akuWgQKk3PVDX7_RhA5oAJgADLDmt7PX7vQBGP3NPp-gCcvtgzX9fp9pMk-pI9MkTJZDBBC2wsD2SJdBmMrKFIsL5Il0ucsqiCqKytVaYZFi1ZC2-nQKckhuNnjNTckluttopDo4HdgXZIfwBNODPthwa9i5Di_DsOjsM98dgnuD3qTJCnA8ZzNZex8PggSX-SnzdYwxcFwof4sYUplo1r5dgStWT3VWAW1sbV22dCcexNfsJ3QIcbTMe1HQnKd0Bnd0aU9BdYGDAAOQNsMjUNd3XXdN1jHdmn3Q9O0LE8M1ZAA1CBvHUe8fwFZxS1fStPzlB8_xVAD1WA0DdQZFDYEgvtqRPWCrXg5xRyQ8D1TQoFgwAVhjPd8J9IjNIjAiYzjGM-io3JaIneiGBxahhVCcxYAAUWgChkgfDj6C4n83w_asv3
 lH8BMbGCgM1EC2zE5Mfyk00ZNCuCR0Q8cVIZNSaTwmMcOXWBoyIyMSPnMilx3JdEwsukrLPGy7NIBznNc9z2KfTiXx8nj_L4oKGyE5twtEn90BAYBTUgGAGC6HoIUtEQEUoHpBRwbwywStJxn-UQ6FgAAKEAAEoEAAPnNQCIHeBBYFAMboAAOnuQ4brQm6rzKABJMpqGYbbtuoA74GOpR4EQEAbvovaglC8l_HGC7vQhwCSCuqBbqUthnrSJz33Mb62D-47ZObaGLrYImAGogMet1ATO_5iXhhHJ3ByHYC5MB_FIOASfGem9WQn90sBGMhdhYXYCF6jJ2IUkciCIA)
   
   ![image](https://github.com/apache/echarts/assets/13038071/3c92487d-1151-4374-a59a-0af1fc59cf74)
   


-- 
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: commits-unsubscribe@echarts.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org