我正在尝试将标签添加到哑铃图(openValueY / valueY)点。 我可以将CircleBullet更改为Triangle,但是在添加LabelBullet时会遇到困难。 我正在使用https://www.amcharts.com/demos/dumbbell-plot/中的演示代码。 Shows the Chart where I want to add a text label at each circle 我在JavaScript部分的末尾添加了以下内容,以使测试保持简单:
let labelBullet = series.bullets.push(new am4charts.LabelBullet());
labelBullet.label.text = "Test";
到目前为止,运气还不好。 我还玩过:
labelBullet.label.fill = am4core.color('#000');
chart.maskBullets = false;
但是无法正常工作!
我还将代码移至jsfiddle https://jsfiddle.net/Cloud4every1/k9mh1eby/ 也许其他人已经解决了类似的问题,或者知道了解决方法/不同的解决方案。
非常感谢!
答案 0 :(得分:0)
之所以发生这种情况,是因为通过将列的宽度设置为1px,可以从柱形图制作哑铃图。如果标签不适合列,则标签将自动隐藏。要禁用此功能,您必须设置:
labelBullet.label.hideOversized = false;
labelBullet.label.truncate = false;