在amcharts甘特图中画一条垂直线代表当前日期?

时间:2019-04-17 02:57:01

标签: javascript amcharts4

*在当前月份绘制一条垂直线。这里是示例代码  * https://codepen.io/anon/pen/PgELdM *这就是我想要实现的  * https://ibb.co/XjVn4WC

console.log("thank you");

1 个答案:

答案 0 :(得分:0)

您可以使用axis guides to draw single lines beneath the chart。例如

var range = dateAxis.axisRanges.create();
range.date = new Date("2016-03-14");
range.grid.stroke = am4core.color("red");
range.grid.strokeWidth = 2;
range.grid.strokeOpacity = 1;

演示:

https://codepen.io/team/amcharts/pen/bb11ebefe894ad526d4bd959fccccf08

如果您需要在各个系列的顶部放置一条线,则可以做的是将全高liney1y20处确定如何获得图表顶部的值...说它只需要number表示像素,但也许可以与am4core.percent(100)一起使用?),因为它的x将日期转换为图表上的坐标(为此,dateAxis will probably have methods),然后将其放在chart.plotContainer中。

相关问题