addMarker

adds a marker to the timeline area

number|string addMarker(MarkerConfig marker);
markerMarkerConfigthe marker's configuration object
number|stringoptional, 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

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
See also
Back to top