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/10/19 03:36:59 UTC

[GitHub] derry66 opened a new issue #9257: echarts4.0 grid自定义多个tooltip无效的问题

derry66 opened a new issue #9257: echarts4.0 grid自定义多个tooltip无效的问题
URL: https://github.com/apache/incubator-echarts/issues/9257
 
 
   <!--
   为了方便我们能够复现和修复 bug,请遵从下面的规范描述您的问题。
   -->
   
   
   ### One-line summary [问题简述]
   一个echarts画布展示多张折线图时,
   根据配置项配置把全局的tooltip移入到grid每个item中,
   此时个个折线图的tooltip没有显示。
   但是使用全局的tooltip时不配置任何是可以的,也就没有了自定义tooltip一说
   
   
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]: 4.1.0
   + Browser version [浏览器类型和版本]:  Google Chrome 69.0.3497.100(正式版本)(64 位)
   + OS Version [操作系统类型和版本]: Windows10 专业版 1803
   
   
   
   
   
   ### Expected behaviour [期望结果]
   在一个echarts画布中可以实现多图表块配置多个tooltip
   
   
   
   
   ### ECharts option [ECharts配置项]
   <!-- Copy and paste your 'echarts option' here. -->
   <!-- [下方贴你的option,注意不要删掉下方 ```javascript 和 尾部的 ``` 字样。最好是我们能够直接运行的 option。如何得到能运行的 option 参见上方的 guidelines for contributing] -->
   ```javascript
   option = {
     title: [
             {
               text: 'grid自定义多个tooltip无效的复现',
               subtext: '',
               left: 'center',
               top: '0',
               textStyle: {
                 color: '#fff'
               }
             }
           ],
           legend: [
             {
               gridIndex: 0,
               top: '4%',
               left: '12%',
               data: ['图表1-1', '图表1-2'],
               itemGap: 5,
               itemWidth: 10,
               itemHeight: 10,
               textStyle: {
                 color: '#fff',
                 fontWeight: 'bolder',
                 fontSize: 12
               }
             },
             {
               gridIndex: 1,
               top: '4%',
               left: '62%',
               data: ['图表2-1', '图表2-2'],
               itemGap: 5,
               itemWidth: 10,
               itemHeight: 10,
               textStyle: {
                 color: '#fff',
                 fontWeight: 'bolder',
                 fontSize: 12
               }
             }
           ],
           grid: [
             {
               top: '80',
               left: '15',
               right: '60%',
               bottom: '2%',
               containLabel: true,
               // tooltip无效
               tooltip: {
                 show: true,
                 trigger: 'axis',
                 formatter: function (params) {
                   return '123'
                 },
                 axisPointer: {
                   type: 'line',
                   axis: 'y'
                 },
                 showContent: true
               }
             },
             {
               top: '80',
               left: '45%',
               right: '100',
               bottom: '2%',
               containLabel: true
             }
           ],
           xAxis: [
             {
               name: '',
               type: 'value',
               scale: true,
               splitLine: {
                 show: false
               },
               axisTick: {
                 show: true,
                 lineStyle: {
                   color: '#fff'
                 }
               },
               axisLine: {
                 show: true,
                 onZero: false,
                 lineStyle: {
                   color: '#ccc'
                 }
               }
             },
             {
               name: '',
               gridIndex: 1,
               type: 'value',
               scale: true,
               splitLine: {
                 show: false
               },
               axisTick: {
                 show: true,
                 lineStyle: {
                   color: '#fff'
                 }
               },
               axisLine: {
                 show: true,
                 onZero: false,
                 lineStyle: {
                   color: '#ccc'
                 }
               }
             }
           ],
           yAxis: [
             {
               name: 'pressure\n(hpa)',
               nameLocation: 'start',
               type: 'category',
               inverse: true,
               boundaryGap: false,
               data: ['10', '20', '30', '50', '70', '100', '150', '200', '250', '300', '400', '500', '700', '850', '925', '1000'],
               scale: true,
               splitLine: true,
               axisLabel: {
                 // formatter: '{value}'
               },
               axisTick: {
                 show: true,
                 lineStyle: {
                   color: '#fff'
                 }
               },
               axisLine: {
                 show: true,
                 onZero: false,
                 lineStyle: {
                   color: '#fff'
                 }
               }
             },
             {
               name: 'pressure\n(hpa)',
               nameLocation: 'start',
               type: 'category',
               gridIndex: 1,
               inverse: true,
               boundaryGap: false,
               data: ['10', '20', '30', '50', '70', '100', '150', '200', '250', '300', '400', '500', '700', '850', '925', '1000'],
               scale: true,
               splitLine: true,
               axisLabel: {
                 // formatter: '{value}'
               },
               axisTick: {
                 show: true,
                 lineStyle: {
                   color: '#fff'
                 }
               },
               axisLine: {
                 show: true,
                 onZero: false,
                 lineStyle: {
                   color: '#fff'
                 }
               }
             }
           ],
           series: [
             {
               name: '图表1-1',
               type: 'line',
               // symbol: 'circle',
               symbolSize: 6,
               data: [10, 20, 50, 30, 20],
               itemStyle: {
                 normal: {
                   color: '#D23531'
                 }
               }
             },
             {
               name: '图表1-2',
               type: 'line',
               // symbol: 'circle',
               symbolSize: 6,
               data: [20, 30, 60, 40, 30],
               itemStyle: {
                 normal: {
                   color: '#CFD131'
                 }
               }
             },
             {
               name: '图表2-1',
               type: 'line',
               xAxisIndex: 1,
               yAxisIndex: 1,
               symbol: 'circle',
               symbolSize: 0,
               itemStyle: {
                 normal: {
                   color: '#d20000'
                 }
               },
               data: [-0.5, 0, -0.2, 0.4, 0.2]
             },
             {
               name: '图表2-2',
               type: 'line',
               xAxisIndex: 1,
               yAxisIndex: 1,
               symbol: 'circle',
               symbolSize: 0,
               itemStyle: {
                 normal: {
                   color: '#00d200'
                 }
               },
               data: [-1.5, 1, -1.2, 1.4, 1.2]
             }
           ]
   }
   
   ```
   
   
   
   
   ### Other comments [其他信息]
   <!-- For example: Screenshot or Online demo -->
   <!-- [例如,截图或线上实例 (JSFiddle/JSBin/Codepen)] -->
   ![grid tooltip](https://user-images.githubusercontent.com/40741023/47196464-381edc80-d393-11e8-8f71-259508c71374.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