Draw a vertical line representing the current date in amcharts gantt chart?

孤街浪徒 提交于 2021-02-11 08:19:27

问题


*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 you");

回答1:


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

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;

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.



来源:https://stackoverflow.com/questions/55719235/draw-a-vertical-line-representing-the-current-date-in-amcharts-gantt-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!