So you may want to add release / milestone markers to your gantt widgets. To do so, you can use the Widget parameter Advanced > Markers Script  to add the markers.




The Markers Script is in javascript language, and it is executed on the server and so you have access to Polarion API.

  • The goal is to add milestone markers via: markerFactory.addMarker() call.
  • You have the access to: ITrackerService via trackerService variable and so you can access various Polarion data sources (time points, plans, work items, etc...).



Following example demonstrates how to load the markers from the polarion project timepoints:


  • Open you widget configuration, expand the Advanced Parameters, and set following snippet to Markers Script:

var timePoints = trackerService.getTrackerProject("elibrary").getTimePoints().iterator();

while(timePoints.hasNext()){

    var tp = timePoints.next();

    var marker = markerFactory.addMarker();

    marker.setText(tp.name);

    marker.setDate(tp.time.date);

    marker.setColor("fuchsia");

    var desc =  tp.description;

    if(desc!=null){

        marker.setTitle(desc.content);

    }

}


The markerFactory has following methods:

  • markerFactory.addMarker(); - create and register new marker object
  • markerFactory.addMarker(String text, String title); - utility method if you do not have a date as java.util.Date but as a string. 
    Example: markerFactory.addMarker("test","2019-01-30")


The marker object has following methods that you should know:

  • void setText(String text) - set the text / name of the marker

  • void setTitle(String tootlip) - set the tooltip of the marker
  • void setDate(java.util.Date date) - set the date of the marker

  • void setDate(String dateStr) - set the date of the marker as String.
    Date format is "2019-01-30"
  • void setColor(String color) - set the color of the marker.
    It must be one of the 16 basic html colors - https://www.w3.org/TR/REC-html40/types.html#h-6.5