Timeline.PropertyId.TIMESTAMP,
Timeline.PropertyId.VALUE);
timeline.setMarkerDataSource(markerDS,
Timeline.PropertyId.TIMESTAMP,
Timeline.PropertyId.CAPTION,
Timeline.PropertyId.VALUE);
timeline.setEventDataSource(eventDS,
Timeline.PropertyId.TIMESTAMP,
Timeline.PropertyId.CAPTION);
mainWindow.addComponent(timeline);
}
Now you should be able to start the application and browse the timeline. The result is shown in Figure 20.11, “Timeline Example Application”.
Figure 20.11. Timeline Example Application
20.3.4. Final Touches
Now that we have our timeline we would probably like to customize it a bit. There are many things you can do but lets start by giving our graph some style properties and a caption in the legend. This can be done as follows:
//Set the caption of the graph timeline.setGraphLegend(graphDataSource, "Our cool graph");
//Set the color of the graph timeline.setGraphOutlineColor(graphDataSource, Color.RED);
//Set the fill color of the graph timeline.setGraphFillColor(graphDataSource, new Color(255,0,0,128));
//Set the width of the graph timeline.setGraphOutlineThickness(2.0);
Lets do the same to the browser areas graph:
//Set the color of the browser graph timeline.setBrowserOutlineColor(graphDataSource, Color.BLACK);
//Set the fill color of the graph timeline.setBrowserFillColor(graphDataSource,
new Color(0,0,0,128));
And the result looks like this: