Skip to content Skip to sidebar Skip to footer

Draw A Vertical Line Representing The Current Date In Amcharts Gantt Chart?

*Draw a vertical line in Current month. here the sample code * https://codepen.io/anon/pen/PgELdM * and this is what I want to achieve * https://ibb.co/XjVn4WC console.log('thank

Solution 1:

You can use axis guides to draw single lines beneath the chart. E.g.

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

Demo:

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

If you need a line on top of the various series, what you can do is make a full height line (y1, y2 at 0, not sure how to get the top of the chart value... says it only takes numbers meaning pixels, but maybe it can work with am4core.percent(100)?), for its x you'll have to convert date to a coordinate on the chart (the dateAxis will probably have methods for that), and place it in the chart.plotContainer.

Post a Comment for "Draw A Vertical Line Representing The Current Date In Amcharts Gantt Chart?"