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 2021/02/01 10:57:38 UTC

[GitHub] [echarts] muleyvarun commented on issue #14176: Tooltip issue in case of multiple grid with xAxis type as 'time'

muleyvarun commented on issue #14176:
URL: https://github.com/apache/echarts/issues/14176#issuecomment-770768176


   Modified code from examples to reproduce the issue:
   
   function randomData() {
       now = new Date(+now + oneDay);
       value = value + Math.random() * 21 - 10;
       return {
           name: now.toString(),
           value: [
               [now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/'),
               Math.round(value)
           ]
       };
   }
   
   var data = [];
   var now = +new Date(1997, 9, 3);
   var oneDay = 24 * 3600 * 1000;
   var value = Math.random() * 1000;
   for (var i = 0; i < 1000; i++) {
       data.push(randomData());
   }
   
   option = {
       title: {
           text: '动态数据 + 时间坐标轴'
       },
       tooltip: {
           trigger: 'axis',
           formatter: function (params) {
               params = params[0];
               var date = new Date(params.name);
               return date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear() + ' : ' + params.value[1];
           },
           axisPointer: {
               animation: false
           }
       },
       grid: [{
           left: 50,
           right: 50,
           height: '35%'
       }, {
           left: 50,
           right: 50,
           top: '55%',
           height: '35%'
       }],
       xAxis: [{
           type: 'time',
           splitLine: {
               show: false
           }
       },{
           type: 'time',
           splitLine: {
               show: false
           },
           gridIndex: 1
       }],
       yAxis: [{
           type: 'value',
           boundaryGap: [0, '100%'],
           splitLine: {
               show: false
           }
       },{
           type: 'value',
           boundaryGap: [0, '100%'],
           splitLine: {
               show: false
           },
           gridIndex: 1
       }],
       series: [{
           name: '模拟数据',
           type: 'line',
           showSymbol: false,
           hoverAnimation: false,
           data: data
       },
       {
           name: '模拟数据',
           type: 'line',
           showSymbol: false,
           hoverAnimation: false,
           data: data,
           xAxisIndex: 1,
           yAxisIndex: 1
       }]
   };
   
   setInterval(function () {
   
       for (var i = 0; i < 5; i++) {
           data.shift();
           data.push(randomData());
       }
   
       myChart.setOption({
           series: [{
               data: data
           },{
               data: data
           }]
       });
   }, 1000);


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

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