addMarker

adds a marker to the timeline area

string addMarker(object marker);

Parameters

markerobjectthe marker's configuration object

Returns

stringthe 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

This method is defined in the marker.js 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 - the marker id
  • start_date - a Date object that sets the marker's start date
  • end_date - a Date object that sets the marker's end date
  • css - a CSS class applied to the marker
  • text - the marker title
  • title - the marker's tooltip
See also
Back to top