I'm reasonably new to jfreechart, and I'm trying to create a chart very much like the DynamicDataDemo chart, but where the date axis is vertical. So this is something like a water fall chart. I launched into doing this, but It seems like things are more complicated that I thought. Although I've managed to create a plot with the axis labeled appropriately, and where there is a date axis which is vertical, I can't the auto range for the axis to work properly because the code seems to want to pull from the "domain" side of the dataset ( which now contains float values not dates ). I'm guessing I could hack this, but it seems there's probably something I'm not getting. So, could someone with more guru tendancies help me out here? Aside from the axis range issue, can you forsee any other gotchas?
-Chris-
Trying to create a Vertical version of DynamicDataDemo...
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Hi Chris,
You are correct that it isn't easy. I want this feature to be supported before 1.0.0 is released. There are two approaches I can think of:
(1) Implement a new YXPlot class (so now you have XYPlot and YXPlot, the parallel of VerticalCategoryPlot and HorizontalCategoryPlot), plus add a VerticalDateAxis class.
(2) Merge all the HorizontalXXX/VerticalXXX classes and add an attribute to the XYPlot and CategoryPlot classes that controls the orientation. The axis classes will need to adapt to being displayed horizontally or vertically at the time they are drawn.
I'm very tempted at the moment to implement (2), it will be more work but the end result will be easier to work with for developers using the library. Any thoughts?
Regards,
Dave Gilbert
You are correct that it isn't easy. I want this feature to be supported before 1.0.0 is released. There are two approaches I can think of:
(1) Implement a new YXPlot class (so now you have XYPlot and YXPlot, the parallel of VerticalCategoryPlot and HorizontalCategoryPlot), plus add a VerticalDateAxis class.
(2) Merge all the HorizontalXXX/VerticalXXX classes and add an attribute to the XYPlot and CategoryPlot classes that controls the orientation. The axis classes will need to adapt to being displayed horizontally or vertically at the time they are drawn.
I'm very tempted at the moment to implement (2), it will be more work but the end result will be easier to work with for developers using the library. Any thoughts?
Regards,
Dave Gilbert
Dave:
It's quite true that #2 is alot more work. However I agree that it's a better solution in the long run. This is especially true for maintenance reasons. #1, will require constantly creating new version of various plot to keep getting both orientations. #2, assuming the classes are written properly, will get that for free.
Also, in implementing #2, it might be possible to place hooks for eventual expansion into plots with 3 axis.
I don't know what your schedule is like, but don't feel comfortable launching into a #2; I don't know the code anywhere near well enough yet. I'm afraid therefore, I'm going to have to hack together a #1, for my purposes, unless you think you can start working on #2 soon, in which case I'm quite happy to help out. Let me know!
It's quite true that #2 is alot more work. However I agree that it's a better solution in the long run. This is especially true for maintenance reasons. #1, will require constantly creating new version of various plot to keep getting both orientations. #2, assuming the classes are written properly, will get that for free.
Also, in implementing #2, it might be possible to place hooks for eventual expansion into plots with 3 axis.
I don't know what your schedule is like, but don't feel comfortable launching into a #2; I don't know the code anywhere near well enough yet. I'm afraid therefore, I'm going to have to hack together a #1, for my purposes, unless you think you can start working on #2 soon, in which case I'm quite happy to help out. Let me know!
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Hi Chris,
There's a couple of things I need to get done before I start looking closely at option (2):
- supporting Serializable in the JFreeChart class (I've started on this, but there's some tricky stuff to do);
- an XML format for chart definitions (need this for JFreeReport), unfortunately this will be impacted by option (2);
- synchronizing dataset updates and chart redrawing for multi-threaded applications.
So you might be best to hack an option (1).
Regards,
Dave Gilbert
There's a couple of things I need to get done before I start looking closely at option (2):
- supporting Serializable in the JFreeChart class (I've started on this, but there's some tricky stuff to do);
- an XML format for chart definitions (need this for JFreeReport), unfortunately this will be impacted by option (2);
- synchronizing dataset updates and chart redrawing for multi-threaded applications.
So you might be best to hack an option (1).
Regards,
Dave Gilbert