Vaadin Timeline and JPAContainer integration

According to the Timeline advertisement page, it is supposed to work with JPAContainer, but I haven’t found any documentation on how this is supposed to work. Has anyone had any luck with integrating Timeline with JPAContainer and would be willing to share their implementation? I’m not sure if I’m close or not, I’ve done the following:

		// Add the timestamp property
		Object timestampProperty = "dmonPhyChannelLockedtime";

		// Add the value property
		Object valueProperty = "dmonPhyChannelPower";
		// Our timeline
		Timeline timeline = new Timeline();

		// Add the container as a graph container
		timeline.addGraphDataSource(entries, timestampProperty,valueProperty);

However, my JPA domain class stores timestamps as Calendar objects, not java.util.Date (so I’m getting an error when trying to run this). Do I have to modify my domain classes to use Date instead or is there some sort of way I can convert the Calendar class to a Date class for the Timeline?

An example project using the Timeline with the JPAContainer can be found at

The Timeline requires that the timestamp value can be cast to an java.util.Date so using a Calendar in your case will not work. You’ll either have to change the domain classes to use Date instead of a Calendar or wrap the JPAContainer in another container which handles the Calendar->Date conversion before handing it to the Timeline.

If you want you could also file an enhancement ticket at
requesting that the Timeline could handle Calendar timestamps as well.

Great, thanks for the tips. I just went ahead and modified my domain class to use Date instead of Calendar and that’s working with one data series. Is it possible to add multiple data series using the same JPAContainer? For instance, if I do something like the following:

Timeline timeline = new Timeline();
// Add the container as a graph container
timeline.addGraphDataSource(entries, "dmonPhyChannelLockedtime","dmonPhyChannelPower");
timeline.addGraphDataSource(entries, "dmonPhyChannelLockedtime","dmonPhyChannelSigQMER");

This only graphs one of the datasets. If I want multiple data series, do I need to break the JPAContainer into separate Index containers for each series I would like to graph?

The Timeline uniquely identifies each graph by its data source so you will need to split up the data into several JPAContainers. If you add the same datasouce with different properties it will just override the previously set value and show only one graph.

Great, thanks for the response, I’m slowly getting it figured out :slight_smile: