I've been trying to customize JFreeChart to my specific needs in displaying MP sitting information (when an MP is sitting in parliament and when he is being represented by a substitute).
First, let me describe what I'm trying to achieve. I'm creating a GUI application for the Office of the Icelandic Parliament. I'm currently working on creating a view that will show how MPs have been sitting in parliament in the past. An MP is a person that has been elected to parliament in his constituency and therefore has a specific constituency number. A primary MP is the person that was originally voted into parliament. A secondary MP is a person that relieves a primary MP if the primary MP needs to be excused. When a secondary MP takes a seat in parliament, he represents the constituency and constituency number that the primary MP whom he is relieving originally represented.
So, I want to display this information graphically using JFreeChart in a similar manner as a GanttChart is displayed:
Code: Select all
Jan 20 Jan 25 Jan 30 Feb 4 Feb 9 Feb 14 Feb 19 Feb 24
|--------------|--------------|--------------|--------------|--------------|--------------|--------------|---------|
| |
+- First rep. of Foo constituency ---------------------------------------------------------------------------------+
| |
| /=John Doe [primary]===/ /=John Doe [primary]===/ |
| /=Doe Johnson [secondary]====/ |
| /=Donny Brasco [secondary]====/ |
+------------------------------------------------------------------------------------------------------------------+
+- Second rep. of Foo constituency --------------------------------------------------------------------------------+
| |
| /= Ziggy [primary]===/ /=Ziggy [primary]========/ /=Ziggy [primary]===/ |
| /=Bill [sec.]=====/ |
| /=Ron [secondary]====/ |
+------------------------------------------------------------------------------------------------------------------+
My problem is basically that I haven't been able to properly do this on my own. I've started trying to create a custom dataset and series classes and my way of doing that is to look at each constituency / number pair as a single series. Each one of these series contains a bunch of SessionSitting elements that represent a single sitting of an MP (the SessionSitting class corresponds in some ways to the Task class for Gantt but not quite. The biggest difference being that the SessionSitting does not have "sub-sittings" to represent many sittings of an MP, instead, the SessionSittingSeries class contains many SessionSitting instances with the same MP reference).
I'm not quite sure if I'm on the right way here. What I'm having the most trouble understanding is the notion of a row and column in the renderer. What is a row and a column in my case? Is each series a column? Each constituency/number pair can have a different number of SessionSitting instances (perhaps the primary MP of that constituency/number never got sick and never had to be substituted) so I'm guessing that row would not be the number of SessionSitting item for a particular SessionSittingSeries.
I'm a bit lost here, so I hope that I've made myself even vaguely understandable. Any help would be greatly appreciated.