Script Variables
The following variables are available in the Markers Script scope:| Variable | Type | Description |
|---|---|---|
markerFactory | MarkerFactory | Factory object for creating and registering timeline markers. |
trackerService | ITrackerService | Polarion tracker service for querying work items and projects via Lucene queries. |
config | Configuration object | The current Gantt configuration, including page parameters and context project ID. |
MarkerFactory Methods
| Method | Return Type | Description |
|---|---|---|
markerFactory.addMarker() | Marker | Create and register a new empty marker object. Set its properties using the marker methods below. |
markerFactory.addMarker(text, date) | Marker | Utility method that creates a marker with the specified text label and date string. Date format: "YYYY-MM-DD". |
markerFactory.addPlanMarkers(query, color) | void | Query Polarion plans matching the Lucene query and add a marker for each plan’s start or end date. |
markerFactory.addWorkItemMarkers(query, dateProperty, color) | void | Query Polarion work items matching the Lucene query and add a marker for each work item using the specified date property. |
Marker Object Methods
The marker object returned byaddMarker() provides these methods:
| Method | Parameter Type | Description |
|---|---|---|
marker.setText(text) | String | Set the text label displayed on the marker line. |
marker.setTitle(tooltip) | String | Set the tooltip text displayed when hovering over the marker. |
marker.setDate(date) | java.util.Date | Set the marker date using a Java Date object. |
marker.setDate(dateStr) | String | Set the marker date using a date string. Format: "YYYY-MM-DD". |
marker.setColor(color) | String | Set the marker color. Must be one of the 16 basic HTML color names (e.g., "red", "blue", "green", "fuchsia"). |
Hovering over a milestone marker displays a tooltip in the format:
Milestone: <name> followed by Due Date: <YYYY-MM-DD>.Marker Positioning
Markers render at the end of the specified date by convention. If you need a marker to appear at the start of a date, subtract one day from the date value.Manually Adding a Marker
Create a marker with explicit values:Adding Markers from Plans
Pull markers automatically from Polarion plans matching a Lucene query:template.id:iteration— filters plans by template IDproject.id:gantt2— restricts to a specific project
plan, enabling distinct visual styling.
Adding Markers from Work Items
Pull markers from Polarion work items matching a Lucene query:type:release— filters work items by type"publicLaunch"— the date field on the work item used to position the marker"blue"— the marker color
Dynamic Project ID
Useconfig.getContextProjectId() to reference the current project instead of hardcoding:
Dynamic Markers with Polarion API
UsetrackerService for full scripting control over marker creation. This approach supports filtering, conditional coloring, and custom tooltip content.
Loading Time Points
Polarion 22 R2 and Older
For older Polarion versions, use direct property access:Dynamic Marker Customization with Page Parameters
CombinetrackerService with page parameters to let users control which markers appear:
Marker CSS Classes
| CSS Class | Applied To | Description |
|---|---|---|
gantt_marker | All markers | Base class applied to every marker element. |
today | Today marker | Applied to the automatic today-date marker line. |
plan | Plan markers | Applied to markers created by addPlanMarkers(). |
Named color class (e.g., blue) | Custom markers | Applied when a color is specified via setColor(). |
Error Handling
- Script errors display as a warning indicator with a count badge in the Gantt toolbar
- The error message includes the prefix Markers Script Error:
- Errors appear in both view mode and wiki editor mode
Configuration Example
A complete Markers Script combining plan markers, work item markers, and a manual milestone:Related Pages
- Item Script API — server-side script for data preparation
- Gantt Config Script API — client-side script for templates and events
- Velocity Context Variables — server-side variables for dynamic script generation
- Page Parameters API — user-input parameters for dynamic marker filtering
- Item Color Legend — default color behavior for task bars
Sources
Sources
KB ArticlesSupport TicketsSource Code
prod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/model/MarkerFactory.javaprod-gantt-src/com.nextedy.polarion.gantt.client/cypress/e2e/ganttCheckWarningInfo.cy.tsprod-gantt-src/com.nextedy.polarion.gantt.client/cypress/e2e/milestones/milestone-tooltip-date.cy.tsprod-gantt-src/com.nextedy.polarion.gantt.client/cypress/e2e/view/markersStyles.cy.tsprod-gantt-src/com.nextedy.polarion.gantt.client/cypress/e2e/milestones/marker-colors.cy.ts