2

Here´s what i want to do: I have in my DB a certain entity, let´s call it "people" and another one, let´s call it "room". The amount of people in the room can change every 15 minutes,i.e full hour, quarter after, etc. Now, i want to create a timechart with jfreechart that shows the amount of people in the room for a period of 3 years, zoomable to the quarter hour (or minute, for all i care :))

Question 1: the dataset. Can i use the JDBCXYDataset to do it or is it better to execute the query and write the data from the resultset to a TimeseriesCollection (code example??)

Question2: i want the chart to initialize showing the whole 3 years and beeing able to zoom in to the individual days/hours/minutes. How do i set this up ?

Thanks for helping.

1 Answer 1

2

Your best bet is going to just run a query and create a TimePeriodValuesCollection. JDBCXYDataset is just an XYDataset.

For your second question, you just need to have your Time Period Series populated with three years of data. If you do that the chart is going to show the whole three years by default. Then you can zoom.

When creating the data, use a TimePeriodValues populated with SimpleTimePeriod 's objects.

Sign up to request clarification or add additional context in comments.

2 Comments

Hm, another question arises. Can (or should) i do series.add(new Minute(...)?
Actually there is not a TimeSeries for 1/4 of an hour. So I am updating my answer to suggest TimePeriodValuesCollection, which you can add a one SimpleTimePeriod object for each 15min time span.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.