You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/04/09 09:56:02 UTC

[GitHub] [echarts] sunYEAN opened a new issue #14636: 柱状堆叠图在有toolbox的情况下,设置max值为100,超过部分被截掉了

sunYEAN opened a new issue #14636:
URL: https://github.com/apache/echarts/issues/14636


   ### Version
   5.0.2
   
   ### Reproduction link
   [https://ecomfe.github.io/echarts-issue-helper/](https://ecomfe.github.io/echarts-issue-helper/)
   
   ### Steps to reproduce
   <!DOCTYPE html>
   <html lang="en">
   <head>
     <meta charset="UTF-8">
     <script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.0.2/echarts.min.js"
             integrity="sha512-t9GZbGKCH5MuYUFsq5AdrhllT0kdnc2fNMizKDgLXBBXgHP2dXxjRPOzYJauAXW9OXLlSYELUqWD30k7cb0Mkg=="
             crossorigin="anonymous"></script>
     <title>Title</title>
   </head>
   <body>
   
   <div id="echarts" style="width: 400px;height: 400px;"></div>
   
   <script>
   
     // 基于准备好的dom,初始化echarts实例
   
     var KEYS = [
       'a',
       'b',
       'c',
       'd',
       'e'
     ];
     var myChart = echarts.init(document.getElementById('echarts'));
   
     const scoreData = [
       { a: '98.30', b: '0.94', c: '0.09', d: '0.66', e: '0.00' },
       { a: '99.00', b: '0.00', c: '0.23', d: '0.68', e: '0.00' },
       { a: '83.41', b: '15.89', c: '0.56', d: '0.13', e: '0.00' },
       { a: '98.66', b: '1.32', c: '0.02', d: '0.00', e: '0.00' },
       { a: '98.04', b: '1.28', c: '0.01', d: '0.67', e: '0.00' },
       { a: '68.89', b: '26.48', c: '3.90', d: '0.64',e: '0.00' },
       { a: '0.00', b: '0.00', c: '0.00', d: '0.00', e: '0.00' },
     ];
     const options = {
       grid: {
         top: 60,
         bottom: 40,
       },
       xAxis: {
         type: 'category',
         data: [
           'item1',
           'item2',
           'item3',
           'item4',
           {
             value: 'error',
             textStyle: {
               fontSize: 15,
               color: 'red'
             }
           },
           'item6',
         ],
       },
       yAxis: {
         type: 'value',
         min: 0,
         max: 100,
         name: '分布占比(%)',
       },
       series: KEYS.map((key) => ({
         name: key,
         data: scoreData.map(score => score[key]),
         type: 'bar',
         stack: 'total',
         barWidth: 20,
       })),
       toolbox: {
         feature: {
           saveAsImage: {
             title: '保存为图片',
           },
         },
       },
       tooltip: {
         trigger: 'axis',
         confine: true,
         renderMode: 'html',
       },
     };
   
     myChart.setOption(options);
   
   </script>
   </body>
   </html>
   
   ### What is expected?
   超过部分展示
   
   ### What is actually happening?
   由于浮点数的精度问题,可能导致item之和大于100,超过100之后就没啦。实际相加之和为100.0000000000001
   
   <!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
   <!-- This issue is in English. DO NOT REMOVE -->


-- 
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.

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] sunYEAN commented on issue #14636: 柱状堆叠图在有toolbox的情况下,设置max值为100,超过部分被截掉了

Posted by GitBox <gi...@apache.org>.
sunYEAN commented on issue #14636:
URL: https://github.com/apache/echarts/issues/14636#issuecomment-817420341


   eg: http://echarts.mnnuu.cn/


-- 
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.

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] echarts-bot[bot] edited a comment on issue #14636: 柱状堆叠图在有toolbox的情况下,设置max值为100,超过部分被截掉了

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] edited a comment on issue #14636:
URL: https://github.com/apache/echarts/issues/14636#issuecomment-816569048


   @sunYEAN It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people, we'd like to suggest using English next time. 🤗
   <details><summary><b>TRANSLATED</b></summary><br>
   
   **TITLE**
   
   In the case of toolbox, the bar stacking chart sets the max value to 100, and the excess is truncated
   
   **BODY**
   
   ### Version
   5.0.2
   
   ### Reproduction link
   [https://ecomfe.github.io/echarts-issue-helper/](https://ecomfe.github.io/echarts-issue-helper/)
   
   ### Steps to reproduce
   ```html
   <!DOCTYPE html>
   <html lang="en">
   <head>
     <meta charset="UTF-8">
     <script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.0.2/echarts.min.js"
    integrity="sha512-t9GZbGKCH5MuYUFsq5AdrhllT0kdnc2fNMizKDgLXBBXgHP2dXxjRPOzYJauAXW9OXLlSYELUqWD30k7cb0Mkg=="
    crossorigin="anonymous"></script>
     <title>Title</title>
   </head>
   <body>
   
   <div id="echarts" style="width: 400px;height: 400px;"></div>
   
   <script>
   
   // Initialize the echarts instance based on the prepared dom
   
   var KEYS = [
       'a',
       'b',
       'c',
       'd',
       'e'
     ];
     var myChart = echarts.init(document.getElementById('echarts'));
   
   const scoreData = [
       { a: '98.30', b: '0.94', c: '0.09', d: '0.66', e: '0.00' },
       { a: '99.00', b: '0.00', c: '0.23', d: '0.68', e: '0.00' },
       { a: '83.41', b: '15.89', c: '0.56', d: '0.13', e: '0.00' },
       { a: '98.66', b: '1.32', c: '0.02', d: '0.00', e: '0.00' },
       { a: '98.04', b: '1.28', c: '0.01', d: '0.67', e: '0.00' },
       { a: '68.89', b: '26.48', c: '3.90', d: '0.64',e: '0.00' },
       { a: '0.00', b: '0.00', c: '0.00', d: '0.00', e: '0.00' },
     ];
     const options = {
       grid: {
         top: 60,
         bottom: 40,
       },
       xAxis: {
         type: 'category',
         data: [
           'item1',
           'item2',
           'item3',
           'item4',
           {
             value: 'error',
             textStyle: {
               fontSize: 15,
               color: 'red'
             }
           },
           'item6',
         ],
       },
       yAxis: {
         type: 'value',
         min: 0,
         max: 100,
         name: 'Distribution ratio (%),
       },
       series: KEYS.map((key) => ({
         name: key,
         data: scoreData.map(score => score[key]),
         type: 'bar',
         stack: 'total',
         barWidth: 20,
       })),
       toolbox: {
         feature: {
           saveAsImage: {
             title: 'Save as a picture',
           },
         },
       },
       tooltip: {
         trigger: 'axis',
         confine: true,
         renderMode: 'html',
       },
     };
   
   myChart.setOption(options);
   
   </script>
   </body>
   </html>
   ```
   
   ### What is expected?
   More than part of the show
   
   ### What is actually happening?
   Due to the accuracy problem of floating points, it may cause the sum of items to be greater than 100, after more than 100. The actual sum is 100.000000000000001
   </details>


-- 
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.

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] echarts-bot[bot] edited a comment on issue #14636: 柱状堆叠图在有toolbox的情况下,设置max值为100,超过部分被截掉了

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] edited a comment on issue #14636:
URL: https://github.com/apache/echarts/issues/14636#issuecomment-816569048


   @sunYEAN It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people, we'd like to suggest using English next time. 🤗
   <details><summary><b>TRANSLATED</b></summary><br>
   
   **TITLE**
   
   In the case of toolbox, the bar stacking chart sets the max value to 100, and the excess is truncated
   
   **BODY**
   
   ### Version
   5.0.2
   
   ### Reproduction link
   [https://ecomfe.github.io/echarts-issue-helper/] (https://ecomfe.github.io/echarts-issue-helper/)
   
   ### Steps to reproduce
   ```html
   <!DOCTYPE html>
   <html lang="en">
   <head>
     <meta charset="UTF-8">
     <script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.0.2/echarts.min.js"
    integrity="sha512-t9GZbGKCH5MuYUFsq5AdrhllT0kdnc2fNMizKDgLXBBXgHP2dXxjRPOzYJauAXW9OXLlSYELUqWD30k7cb0Mkg=="
    crossorigin="anonymous"></script>
     <title>Title</title>
   </head>
   <body>
   
   <div id="echarts" style="width: 400px;height: 400px;"></div>
   
   <script>
   
   Initialize the echarts instance based on the prepared dom
   
   var KEYS = [
       'a',
       'b',
       'c',
       'd',
       'e'
     ];
     var myChart = echarts.init(document.getElementById('echarts'));
   
   const scoreData = [
       { a: '98.30', b: '0.94', c: '0.09', d: '0.66', e: '0.00' },
       { a: '99.00', b: '0.00', c: '0.23', d: '0.68', e: '0.00' },
       { a: '83.41', b: '15.89', c: '0.56', d: '0.13', e: '0.00' },
       { a: '98.66', b: '1.32', c: '0.02', d: '0.00', e: '0.00' },
       { a: '98.04', b: '1.28', c: '0.01', d: '0.67', e: '0.00' },
       { a: '68.89', b: '26.48', c: '3.90', d: '0.64',e: '0.00' },
       { a: '0.00', b: '0.00', c: '0.00', d: '0.00', e: '0.00' },
     ];
     const options = {
       grid: {
         top: 60,
         bottom: 40,
       },
       xAxis: {
         type: 'category',
         data: [
           'item1',
           'item2',
           'item3',
           'item4',
           {
             value: 'error',
             textStyle: {
               fontSize: 15,
               color: 'red'
             }
           },
           'item6',
         ],
       },
       yAxis: {
         type: 'value',
         min: 0,
         max: 100,
         name: 'Distribution ratio (%),
       },
       series: KEYS.map((key) => ({
         name: key,
         data: scoreData.map(score => score[key]),
         type: 'bar',
         stack: 'total',
         barWidth: 20,
       })),
       toolbox: {
         feature: {
           saveAsImage: {
             title: 'Save as a picture',
           },
         },
       },
       tooltip: {
         trigger: 'axis',
         confine: true,
         renderMode: 'html',
       },
     };
   
   myChart.setOption(options);
   
   </script>
   </body>
   </html>
   ```
   
   ### What is expected?
   More than part of the show
   
   ### What is actually happening?
   Due to the accuracy problem of floating points, it may cause the sum of items to be greater than 100, after more than 100. The actual sum is 100.000000000000001
   </details>


-- 
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.

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] pissang commented on issue #14636: 柱状堆叠图在有toolbox的情况下,设置max值为100,超过部分被截掉了

Posted by GitBox <gi...@apache.org>.
pissang commented on issue #14636:
URL: https://github.com/apache/echarts/issues/14636#issuecomment-969728352


   Should have been fixed in the latest version


-- 
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] pissang closed issue #14636: 柱状堆叠图在有toolbox的情况下,设置max值为100,超过部分被截掉了

Posted by GitBox <gi...@apache.org>.
pissang closed issue #14636:
URL: https://github.com/apache/echarts/issues/14636


   


-- 
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] echarts-bot[bot] commented on issue #14636: 柱状堆叠图在有toolbox的情况下,设置max值为100,超过部分被截掉了

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #14636:
URL: https://github.com/apache/echarts/issues/14636#issuecomment-816569014






-- 
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.

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