addMarker

向时间轴区域添加一个marker

number|string addMarker(MarkerConfig marker);
markerMarkerConfigmarker的配置对象
number|string可选,marker的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

该方法属于marker扩展的一部分,请确保启用了marker插件。更多详情请参阅添加垂直标记文章。

配置对象包括以下属性:

  • id? - (string | number) - marker的id
  • start_date - (Date) - 指定marker开始时间的Date对象
  • end_date? - (Date) - 指定marker结束时间的Date对象
  • css? - (string) - 用于样式化marker的CSS类
  • text? - (string | number) - marker的标题文本
  • title? - (string | number) - marker的tooltip文本
See also
Back to top