I would like to add vertical lines to graph as markers for interesting events.
The only way i can see to add multiple lines is to define multiple controller.verticalLine
annotations like
controller.verticalLine({
xAnchor: "2007-09-23"
});
controller.verticalLine({
xAnchor: "2008-10-23"
});
Is it possible to do this nicer like
controller.verticalLine([{
xAnchor: "2007-09-23"
},
{
xAnchor: "2007-10-23"
},
{
xAnchor: "2007-11-23"
}]);
or better, pass it a data set using mapAs
, where each value in the mapping would be a xAnchor
value ?
var mapping = dataTable.mapAs({"value": 4});
controller.verticalLine(mapping);
Thanks
You can define the lines from the dataset with the custom field and get them from data with the get() method: https://api.anychart.com/latest/anychart.data.Mapping#get
mapping.get(i, "anchor"),
Like is shown here: https://jsfiddle.net/osub60ck/