timeline - Apexcharts - 条形图太小
问题描述
我正在使用 Apexcharts 3.19.0 中的时间线图,我注意到每次添加新的垂直“类别”时,条形都会开始缩小。是否可以将条形高度设置为固定大小?
我正在构建一个代表生产线的时间线图。酒吧是生产,类别是机器。一个版本只与一台机器相关。
这是我通过的系列,如果我继续添加新机器,酒吧会继续缩小。
我注意到 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
],
}
]
}
]
这就是我的图表的样子
解决方案
我有一个类似的问题,我通过使用公共共享“x”值(在您的示例中为“Production”)并在随后由 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"]
}
}
在这里查看
推荐阅读
- redux - Redux 不可变更改数组顺序
- regex - 如何从 Hive 中的字符串正则表达式数字间隔
- c++ - C ++:使用另一个字符大写一个字符
- gridview - Xamarin Forms GridView 不会将图像放在第二行
- programming-languages - 当语言只有“循环而不是零”时,如何比较数字?
- javascript - 如何通过 DoubleClick Studio 中的 js 文件映射资源?
- powershell - 在嵌套 PSObject 属性上重载 ToString 的问题
- javascript - 如何将对象数组中的数字加倍?
- java - Salesforce:无需登录即可使用哪个 API?
- ios - 形状,多边形,未在 GoogleMaps swift 上显示