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/08/15 08:36:00 UTC

[GitHub] zhjb7 commented on issue #8867: 对数坐标的指数为10,怎样不显示10,100,1000,而是显示20,200,2000?

zhjb7 commented on issue #8867: 对数坐标的指数为10,怎样不显示10,100,1000,而是显示20,200,2000?
URL: https://github.com/apache/incubator-echarts/issues/8867#issuecomment-413131543
 
 
   谢谢 Ovilia,我刚刚实现了这个chart。我一共加入了2个X轴,第1个原来的对数轴给隐藏了,第2个X轴设置为数值轴,但只显示X轴标签最小值20和最大值20000。之后加入了4个bar的series,每个bar宽度设置为1,data设置为[200,y轴最小值],[200,y轴最大值],[2000,y轴最小值],[2000,y轴最大值],其中y轴最小值的2个bar设置label为显示为x轴的值。
   代码如下:
   
   option = {
               title: {
                   text: '对数轴示例',
                   left: 'center'
               },
               yAxis: {
                   type: 'value',
                   min:-20,max:20,interval:4
               },
   
               xAxis: [
                   {
                       show:false,
                       name:"real_x_axis",
                       position:"top",
                       type:"log",
                       logBase:10,
                       nameGap:30,
                       axisTick:{show:false},
                       axisLine:{
                           lineStyle:{
                               width:1.5,
                               color:"#F0F0F0"
                           }
                       },
                       axisLabel:{
                           show:true,
                           color:"#000000"
                       },
                       min:20,
                       max:20000
                   },
                   {
                       type:"value",
                       position:"bottom",
                       axisLine:{
                           lineStyle:{
                               width:1.5,
                               color:"#000000"
                           }
                       },
                       axisTick:{show:false},
                       axisLabel:{
                           show:true,
                           showMinLabel:true,
                           showMaxLabel:true,
                           color:"#000000"
                       },
                       interval:20000,
                       min:20,
                       max:20000
                   }
               ],
               series: [
                   {
                       type: 'line',
                       smooth:true,
                       data: [[1000, 3],[2000,9],[3000,3]]
                   },
                   {
                       type: 'bar',
                       barWidth:1,
                       itemStyle:
                       {
                           color:"#000000"
                       },
                       data: [[200,20],
                       {
                           value: [200,-20],
                           label:
                           {
                               show:true,
                               color:"#000000",
                               position:"insideBottom",
                               distance:-20,
                               formatter: '{@[0]}'
                           }
                       },
                       [2000,20],
                       {
                           value: [2000,-20],
                           label:
                           {
                               show:true,
                               color:"#000000",
                               position:"insideBottom",
                               distance:-20,
                               formatter: '{@[0]}'
                           }
                       }]
                   }
               ]
           };
   
   ![q -20180815163500](https://user-images.githubusercontent.com/7479250/44139306-44ad1c54-a0a9-11e8-8efa-138e3ef53a3e.png)
   

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