Faithforus commented on issue #6447: 请问是否支持多grid多yAxis的图表?
URL: 
https://github.com/apache/incubator-echarts/issues/6447#issuecomment-447708124
 
 
   > 已解决。
   > xAxis和yAxis的数量与gridIndex都一致就ok了。
   > 感谢。
   请问右边两个Y轴要怎么引用,我的数据渲染都是对应左边Y轴上的值,需要加什么吗?
   
   option = {
   
       tooltip: {
           trigger: 'item'
       },
   
       xAxis: [{ //上面横轴
               axisLine: {
   
               },
               splitLine: {
                   show: true,
                   lineStyle: {
                       type: 'dotted'
                   }
               },
               axisLabel: {
                   show: false,
               },
               axisTick: {
                   show: false
               },
               data: []
   
           },
           { //下层横轴
               data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
               splitLine: {
                   show: true,
                   lineStyle: {
                       type: 'dotted'
                   }
               },
               gridIndex: 1,
               axisLabel: {
   
   
               }
   
           }
       ],
       yAxis: [{
               //左上y轴
   
               position: 'left',
   
               axisLabel: {
                   margin: -25,
                   color: function(value) {
                       if (value < 0) {
                           return 'green';
                       }
                       if (value > 0) {
                           return 'red';
                       }
                       return 'black';
   
                   },
               },
               axisTick: {
                   show: false
               },
   
               splitLine: {
                   show: true,
                   lineStyle: {
                       type: 'dotted'
                   }
               },
           },
   
           { //左下y轴
   
               axisLabel: {
                   color: 'green',
                   show: true,
                   margin: -25,
               },
               axisTick: {
                   show: false
               },
               splitLine: {
                   show: true,
                   lineStyle: {
                       type: 'dotted'
                   }
               },
               gridIndex: 1
           },
   
   
           { //右上轴
               splitLine: {
                   show: false
               },
               position: 'right',
               min: -1.01,
               max: 1.01,
               axisTick: {
                   show: false
               },
               axisLabel: {
                   align: 'right',
                   margin: -5,
                   formatter: '{value} %',
                   color: function(value) {
                       if (value < 0) {
                           return 'green';
                       }
                       if (value > 0) {
                           return 'red';
                       }
                       return 'black';
   
                   },
               }
           },
   
           { //右下y轴
               splitLine: {
                   show: false
               },
               position: 'right',
               min: 84,
               max: 930,
               axisTick: {
                   show: false
               },
               axisLabel: {
                   margin: -25,
                   color: 'green'
               },
               gridIndex: '1'
   
           }
       ],
       grid: [{
           bottom: '50%'
       }, {
           top: '50%'
       }],
       series: [{
           //左上 面积图
           type: 'line',
           areaStyle: {},
           showSymbol: false,
           data: [11, 22, 33, 44, 55, 66, 77]
       }, { //右上  百分比
           type: 'line',
           showSymbol: false,
           data: [1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, -0.5]
       }, {
           //右下坐标数据  柱形图
           type: 'bar',
           showSymbol: false,
           data: [30, 40, 80, 60, 70, 70, 60, 600],
           xAxisIndex: '1',
           yAxisIndex: '1'
       }, {
           //左下数据
           type: 'line',
           showSymbol: false,
           data: [56, 78, 95, 100, 120, 130, 140, 200, 20],
           xAxisIndex: '1',
           yAxisIndex: '1'
       }]
   };

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to