Kurioni opened a new issue, #20239:
URL: https://github.com/apache/echarts/issues/20239

   ### Version
   
   5.2.2
   
   ### Link to Minimal Reproduction
   
   -
   
   ### Steps to Reproduce
   
   -
   
   ### Current Behavior
   
   -
   
   ### Expected Behavior
   
   -
   
   ### Environment
   
   _No response_
   
   ### Any additional comments?
   
   Hello!
   Is it possible to get current data on X and Y positions and display them in 
Tooltip. I want to get data that gets into label and display them next to the 
mouse when hovering over the chart.
   
   Code for reproduction (for Echarts sandbox): 
   `
   var base = +new Date(2016, 9, 3);
   var oneDay = 24 * 3600 * 1000;
   var valueBase = Math.random() * 300;
   var valueBase2 = Math.random() * 50;
   var data = [];
   var data2 = [];
   
   for (var i = 1; i < 10; i++) {
     var now = new Date((base += oneDay));
     var dayStr = [now.getFullYear(), now.getMonth() + 1, 
now.getDate()].join('-');
   
     valueBase = Math.round((Math.random() - 0.5) * 20 + valueBase);
     valueBase <= 0 && (valueBase = Math.random() * 300);
     data.push([dayStr, valueBase]);
   
     valueBase2 = Math.round((Math.random() - 0.5) * 20 + valueBase2);
     valueBase2 <= 0 && (valueBase2 = Math.random() * 50);
     data2.push([dayStr, valueBase2]);
   }
   
   option = {
     animation: true,
     tooltip: {
       trigger: 'axis',
       position: function (pt) {
         return [pt[0] + 10, pt[1] + 10];
       },
       formatter: '{current xAxis time???}'
     },
     xAxis: {
       type: 'time',
       // boundaryGap: [0, 0],
       axisPointer: {
         snap: false,
         lineStyle: {
           color: '#004E52',
           opacity: 0.5,
           width: 1
         },
         label: {
           show: true,
           formatter: function (params) {
             return echarts.format.formatTime('hh:mm', params.value);
           },
           backgroundColor: '#004E52'
         },
         handle: {
           show: true,
           icon: 'none'
         }
       },
       splitLine: {
         show: false
       }
     },
     yAxis: {
       type: 'value',
       axisTick: {
         inside: true
       },
       splitLine: {
         show: false
       },
       axisLabel: {
         inside: true,
         formatter: '{value}\n'
       },
       z: 10
     },
     grid: {
       top: 110,
       left: 15,
       right: 15,
       height: 160
     },
     dataZoom: [
       {
         type: 'inside',
         throttle: 50
       }
     ],
     series: [
       {
         name: '模拟数据',
         type: 'line',
         smooth: true,
         symbol: 'circle',
         symbolSize: 5,
         sampling: 'average',
         itemStyle: {
           normal: {
             color: '#8ec6ad'
           }
         },
         stack: 'a',
         areaStyle: {
           normal: {
             color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
               {
                 offset: 0,
                 color: '#8ec6ad'
               },
               {
                 offset: 1,
                 color: '#ffe'
               }
             ])
           }
         },
         data: data
       },
       {
         name: '模拟数据',
         type: 'line',
         smooth: true,
         stack: 'a',
         symbol: 'circle',
         symbolSize: 5,
         sampling: 'average',
         itemStyle: {
           normal: {
             color: '#d68262'
           }
         },
         areaStyle: {
           normal: {
             color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
               {
                 offset: 0,
                 color: '#d68262'
               },
               {
                 offset: 1,
                 color: '#ffe'
               }
             ])
           }
         },
         data: data2
       }
     ]
   };
   
   `


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to