addMarker
Description
Adds a marker to the timeline area
addMarker: (marker: MarkerConfig) => number | string
Parameters
marker- (required) MarkerConfig - the marker's configuration object
Returns
markerId- (number|string) - optional, the marker's id
Example
var todayMarker = gantt.addMarker({
start_date: new Date(),
css: "today",
title:date_to_str( new Date())
});
setInterval(function(){
var today = gantt.getMarker(todayMarker);
today.start_date = new Date();
today.title = date_to_str(today.start_date);
gantt.updateMarker(todayMarker);
}, 1000*60);
Related samples
Details
note
This method is defined in the marker extension, so you need to enable the marker plugin. Read the details in the Adding Vertical Markers article.
The configuration object has the following properties:
- id? - (string | number) - the marker id
- start_date - (Date) - a Date object that sets the marker's start date
- end_date? - (Date) - a Date object that sets the marker's end date
- css? - (string) - a CSS class applied to the marker
- text? - (string | number) - the marker title
- title? - (string | number) - the marker's tooltip