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 2022/03/31 08:33:07 UTC

[GitHub] [echarts] jiawulin001 commented on issue #16783: [Bug] The y-axis is not displayed in the correct position

jiawulin001 commented on issue #16783:
URL: https://github.com/apache/echarts/issues/16783#issuecomment-1084264977


   Both x axis and y axis is by default locked at zero of each other. Only after you set `axis.axisLine.onZero` to `false` can you unlock and move it as you wish.
   <details>
   <summary>Code Sample</summary>
   
   ```
   option = {
     legend: {
       data: ['line11', 'line22']
     },
     tooltip: {
       trigger: 'axis',
       axisPointer: {
         type: 'cross',
         animation: false
       }
     },
     toolbox: {
       show: true,
       feature: {
         dataZoom: {
           // yAxisIndex: 'none'
         },
         dataView: { readOnly: false },
         //magicType: {type: ['line']},
         restore: {},
         saveAsImage: {}
       }
     },
     grid: {
       top: 70,
       bottom: 50
     },
     xAxis: [
       {
         type: 'value',
         name: 'xAxisName111',
         // scale: true
       },
       {
         name: 'xAxisName222',
         type: 'value'
       }
     ],
     yAxis: [
       {
         name: 'yAxisName1111',
         type: 'value',
         axisLine: {
           onZero: false
         }
       },
       {
         name: 'yAxisName2222',
         type: 'value',
         axisLine: {
           onZero: false
         },
       }
     ],
     series: [
       {
         name: 'line11',
         symbolSize: 5,
         data: [
           [-10, 4],
           [1.1, 9],
           [1.21, 18],
           [1.32, 40],
           [1.53, 71],
           [1.74, 88],
           [1.85, 55],
           [1.96, 32],
           [2.07, 9],
           [2.38, 0.2]
         ],
         type: 'line',
         smooth: true,
         showSymbol: false,
         yAxisIndex: 0,
         xAxisIndex: 0
         // barGap: 0
       },
       {
         name: 'line22',
         symbolSize: 5,
         yAxisIndex: 1,
         xAxisIndex: 0,
         data: [
           [0.98, 1],
           [1.3, 6],
           [1.41, 27],
           [1.62, 45],
           [1.73, 77],
           [1.84, 85],
           [2.05, 47],
           [2.16, 18],
           [2.37, 6],
           [2.38, 0.2]
         ],
         type: 'line',
         smooth: true,
         showSymbol: false,
         barGap: 0
       }
     ]
   };
   ```
   </details>
   @pissang @plainheart I think setting `axisLine.onZero` as true by default would be sometimes very confusing, because it will make `axis.position` and `axis.offset` completely dead before user find out there's a `onZero` locking these options. I would suggest we at least clarify that user should turn off `onZero` before they use `position` and `offset`.


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