Apex 图表时间轴 - 数据标签与工具提示和标题不同步

问题描述

我们正在使用 ApexCharts 时间线。 我们使用系列来显示项目持续时间。 一切似乎都没问题,但我们的宽度数据标签有问题。

数据标签与工具提示标题不同步。

一个系列还可以...

series: [
{
  name: "AMISOC",data: [
    {
      x: "Gestion des mesures d'intégration",y: [new Date("2020-06").getTime(),new Date("2021-06").getTime()],},{
      x: "Portefeuilles + validations - Stabilisation",{
      x: "Stat OFS AMIG - lot 3",new Date("2021-04").getTime()],{
      x: "Test 3  VZA",y: [new Date("2021-01").getTime(),new Date("2022-03").getTime()],}
  ]
},{
  name: "FE",data: [
    {
      x: "Trafic des paiements (lot 2)",{
  name: "IT",data: [
    {
      x: "Migration Windows et Outils bureautique",y: [new Date("2021-03").getTime(),{
      x: "Upgrade technique Infrastucture 2021",new Date("2021-12").getTime()],

...

],

serie OK

但是在标题之后没有跟随相关的标题名称。 在工具提示中可以,但在 dataLabel 中不行。

有人看到我们做错了什么吗?

serie NOT SYNC

这是一个代码笔:https://codepen.io/vinchoz/pen/rNjOKwv

解决方法

我确实找到了一个可行的解决方案:

我替换此代码

formatter: function (val,opt) {
  return opt.w.globals.labels[opt.dataPointIndex];
},

通过这个代码

formatter: function(val,obj) {
    return obj.w.config.series[obj.seriesIndex].data[obj.dataPointIndex].x;
},

https://codepen.io/vinchoz/pen/oNBLOaB