Browse by category:
|| | ||
How can I display a vertical line in a JViews Gantt Chart to mark the current time?
The Gantt Sheet is actually an instance of
IlvManagerView, the viewclass in the Graphics Framework. You can easily add static JViews graphic objects to a Gantt chart or Schedule chart. In this case, we add a vertical line. The following source code is from a class definition that extends the JViews class
IlvGanttSheet sheet = _chart.getGanttSheet();
IlvTimeConverter timeConverter = sheet.getTimeConverter();
// First get the x position of the current date in manager coordinates.
final float x = (float)timeConverter.getUnits(new Date());
sheet.getManager().addObject(this, _layer, true);
When displaying such a line, two other issues must be handled. You must make the line long enough to cover all of the visible range of the chart, even when new rows are added, and you must refresh the position of the line periodically in case the user has zoomed in far enough to see time passing.
The complete source is provided in this file: timenow.zip.
The code defines a class that displays a vertical line at the current time in a Gantt or Schedule chart. The line moves as time passes. The refresh rate of the line, as well as its appearance, are customizable.
Download and extract the file. Then read the html file it contains,
Note: Starting from JViews Gantt 8.0, Time Indicators are supported by the
IlvTimeIndicator abstract base class and its two concrete implementations:
For more information about this feature, refer to the following section:
Developing with the SDK > Gantt Charts > Using the Gantt Sheet > Time Indicators
The associated code sample can be found in the Code Examples section of the Documentation and is located here:
|Also listed in|
|Visualizations -> JViews -> Enterprise|
|Visualizations -> JViews -> Gantt|
|Use of IlvFixedSizeGraphic or IlvHalfZoomingGraphic to control...||Display a threshold (as an horizontal line) in my chart|