Apexcharts - 条形图太小

Apexcharts - bars are too small

我使用的是 Apexcharts 3.19.0 的时间线图表,我注意到每次添加新的垂直线时 "category" 条形图都会开始缩小。是否可以将条形高度设置为固定大小?

我正在构建一个表示生产线的时间线图表。酒吧是产品,类别是机器。一个构建只与一台机器相关。

这是我通过的系列,如果我继续添加新机器,酒吧会继续缩小。

我注意到 Apexcharts 使每个条形的高度都使得每一行都可以占据所有条形,但我不需要这个。

    [
  {
    "name": "B-2004281001-6763",
    "data": [
      {
        "x": "Cube 3-1",
        "y": [
          1588068083109,
          1588071676403
        ],
      }
    ]
  },
  {
    "name": "B-2004281000-8133",
    "data": [
      {
        "x": "BiZon Prusa i3 Steel-2",
        "y": [
          1588068021615,
          1588075213496
        ],
      }
    ]
  },
  {
    "name": "B-2004281001-9110",
    "data": [
      {
        "x": "BiZon Prusa i3 Steel-2",
        "y": [
          1588068068356,
          1588078856311
        ],
      }
    ]
  }
]

这就是我的图表的样子

My Chart

我有一个类似的问题,我通过使用一个共同的共享 "x" 值(在您的示例中为 "Production" )并在系列数据数组中设置 "name" 值来解决它然后由dataLabels显示。

所以你修改的数据:

[
  {
    name: "B-2004281001-6763",
    data: [{ name: "Cube 3-1", x: "Production", y: [ 1588068083109, 1588071676403 ] }]
  },
  {
    name: "B-2004281000-8133",
    data: [{ name: "BiZon Prusa i3 Steel-2", x: "Production", y: [1588068021615, 1588075213496 ] }]
  },
  {
    name: "B-2004281001-9110",
    data: [{ name: "BiZon Prusa i3 Steel-2", x: "Production", y: [1588068068356, 1588078856311 ], } ]
  }
]

和相应的 dataLabels 选项(可见性为黑色文本)

dataLabels: {
  enabled: true,
  formatter: function(val, opts) {
    return opts.w.config.series[opts.seriesIndex].data[opts.dataPointIndex].name;
  },
  style: {
    colors: ["#000000"]
  }
}

看看here