You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by "helgasoft (via GitHub)" <gi...@apache.org> on 2023/05/09 20:58:05 UTC

[GitHub] [echarts] helgasoft commented on issue #18599: [Bug] tooltip alignment with xAxis Date

helgasoft commented on issue #18599:
URL: https://github.com/apache/echarts/issues/18599#issuecomment-1540880917

   xAxis needs to be **the same** for both connected charts. Also, setting axis _data_ makes the axis automatically type _category_.  You need xAxis type _time_, means all data has to be in the series.
   _tooltip.trigger:"item"_ will not work for connected, has to be _tooltip.trigger:"**axis**"_
   Try the following code. Tooltip has some glitches (first point or lower chart), but works most of the time.
   ```
   op1 = {
     tooltip: { trigger: "axis", formatter: '{c}'},
     xAxis: { type: "time"},
     yAxis: { type: "value"},
     series: [
       {
         data: [
          [ new Date("2023-05-05T16:00:00"),820],
          [ new Date("2023-05-05T17:00:00"),932],
          [ new Date("2023-05-05T19:00:00"),934],
          [ new Date("2023-05-05T20:00:00"),1290],
          [ new Date("2023-05-05T21:00:00"),1330],
          [ new Date("2023-05-05T22:00:00"),1320]
         ],
         type: "line",
         smooth: true
       }
     ]
   };
   op2 = echarts.util.clone(op1);
   op2.series[0].data.splice(2, 0, [ new Date("2023-05-05T18:00:00"),901] );
   chart1.setOption(op1);
   chart2.setOption(op2);
   echarts.connect([chart1, chart2]);
   ```


-- 
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: commits-unsubscribe@echarts.apache.org

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