You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/07/10 03:45:16 UTC

[GitHub] HeZhaoyin opened a new issue #8671: 将y轴设成对数轴后,y轴不能从0开始,当有数据为0的时候,渲染渐变会报错

HeZhaoyin opened a new issue #8671: 将y轴设成对数轴后,y轴不能从0开始,当有数据为0的时候,渲染渐变会报错
URL: https://github.com/apache/incubator-echarts/issues/8671
 
 
   <!--
   为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
   -->
   
   
   ### One-line summary [问题简述]
   将yAxis的type属性设置成log之后,y轴能否从0开始?(现在我将最小值设成1后勉强能达到效果)
   当有数据为0时,我是柱状图,使用 new echarts.graphic.LinearGradient方法制作渐变效果的时候,会报错,貌似是因为rect.y和rect.height有时候会变成NaN和infinity...(预估是因为y轴上没有0而数据中有0导致?不确定)
   
   提供了option,可以测试。
   
   
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]:
   + Browser version [浏览器类型和版本]:
   + OS Version [操作系统类型和版本]:
   
   
   
   
   
   ### Expected behaviour [期望结果]
   
   
   
   
   
   ### ECharts option [ECharts配置项]
   <!-- Copy and paste your 'echarts option' here. -->
   <!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
   ```javascript
   option ={
     color: ['#3398DB'], // 图表颜色
     tooltip: {
       trigger: 'axis',
       axisPointer: { // 坐标轴指示器,坐标轴触发有效
         type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
       }
     },
     grid: {
       top: '3%',
       left: '0%',
       right: '0%',
       bottom: '0%',
       containLabel: true
     },
     xAxis: [{
       show: true,
       type: 'category',
       data: ['', '', '', '', '', '', ''],
       axisTick: {
         alignWithLabel: true
       },
       axisLabel: {
         fontSize: 14,
         rotate: 40
       }
     }],
     yAxis: [{
       // type: 'value'
       type: 'log',
       min: 1,
     }],
     series: [{
       name: '积分池容量',
       type: 'bar',
       barWidth: '60%',
       barMaxWidth: 50,
       itemStyle: {
         normal: {
           label: {
             show: true, // 顶部数字展示
             position: 'top', // 这里可以自己选择位置
             textStyle: {
               fontWeight: 'bolder',
               fontSize: '14',
               fontFamily: '微软雅黑',
               color: '#000000'
             }
           },
           // 圆柱颜色
           color: new echarts.graphic.LinearGradient(
             0, 0, 0, 1, [{
                 offset: 0,
                 color: '#117bf1'
               },
               {
                 offset: 0.9,
                 color: '#7acffd'
               }
             ]
           )
         }
       },
       data: [231233, 0, 565, 1231, 6546,3432, 0]
     }]
   }
   
   ```
   
   
   
   
   ### Other comments [其他信息]
   <!-- For example: Screenshot or Online demo -->
   <!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
   
   \node_modules\zrender\lib\graphic\Style.js这个文件
   createLinearGradient函数中加入:
   if(isNaN(rect.height)){
       rect.height = 0;
       rect.y = 0;
     }
     if (rect.height == Infinity){
       rect.height = 0;
     }
   
   就好了(不过还不知道有没有其他问题,只是图表显示正常了)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

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