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/26 10:03:08 UTC

[GitHub] sxmpasch commented on issue #9283: Set tooltip relative to position of data in chart

sxmpasch commented on issue #9283: Set tooltip relative to position of data in chart
URL: https://github.com/apache/incubator-echarts/issues/9283#issuecomment-433357224
 
 
   Yes, but you use an emphasis label for a series. Example (modified from https://ecomfe.github.io/echarts-examples/public/editor.html?c=dynamic-data2):
   
   ```
   function randomData(aa,x) {
       now = new Date(+now + oneDay);
       value[aa] = value[aa] + Math.random() * 21 - 10 - (aa*Math.random()*3);
       return {
           name: now.toString(),
           value: [
               [x].join('/'),
               Math.round(value[aa])
           ]
       }
   }
   
   var data = [], data2=[];
   var now = +new Date(1997, 9, 3);
   var oneDay = 24 * 3600 * 1000;
   var value = [Math.random() * 1000,Math.random() * 1600];
   for (var i = 0; i < 1000; i++) {
       data.push(randomData(0,i));
       data2.push(randomData(1,i));
   }
   
   option = {
       title: {
           text: '动态数据 + 时间坐标轴'
       },
           tooltip: {
               trigger: 'axis',
               showContent: false,
               axisPointer: {
                   type: 'cross',
                   animation: false,
                   label: {
                       show:false
                   },
               },
           },
       xAxis: {
           type: 'value',
           splitLine: {
               show: false
           },
           axisPointer: {
               show:true,
           }
       },
       yAxis: {
           type: 'value',
           boundaryGap: [0, '100%'],
           splitLine: {
               show: false
           }
       },
       series: [{
           name: 'S12',
           type: 'line',
           showSymbol: false,
           emphasis: {
               label: {
                   show:true,
                   position:'right',
                   fontSize:24,
               }
           },
           data: data
       },
       {
           name: 'S2',
           type: 'line',
           showSymbol: false,
           emphasis: {
               label: {
                   show:true,
                   position:'right',
                   fontSize:24,
               }
           },
           data: data2
       }    
       ]
   };
   
   ```
   

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