Hi All
I've added some code to allow the plotting of a secondary y axis, you can download it from
http://www.i-tao.com/jfreechart/jfreechartpatch.zip
It's very much a work in progress (probably full of bugs), but it takes me to where I want to be on my current project.
Changes made are...
VerticalNumberAxis
- added second axis flag
- calculate right hand axis plot area if 2nd axis flag set
VerticalCategoryPlot
- added use second axis flag
- draw the 2nd axis if flag set
OverlaidVerticalCategoryPlot
- set 2nd axis when adding subplot with this flag
- added getMax..DataValue and getMin.. for 2nd axis
CategoryPlot
- added range2ndAxis attribute
I've put a "//2nd y axis change" comment on all places where I've added code
there's a OverLaidChartServletDemo with example of how this code is used
known problems
- can't set 1st axis to be autorange
- title on 2nd axis not showing (just need some maths that I've not got time to figure out at the moment)
The patch is provided 'as-is', I'm in the midst of a couple of projects and therefore may not be able to reply promptly to any queries.
*NB* David Gilbert and the team deserves a big "we're not worthy" salute. I got to this point in less than a couple of days, not because of any cleverness on my part but purely down to how well laid out the code was. It was easy to understand and (call me sad) an absolute joy to work with. It's difficult enough to write something like this, but to write it in such a neat fashion....awesome!
working 2nd y axis patch
Re: working 2nd y axis patch
Hi Ron,
Thanks for sharing your code. I'll be sure to take a look at what you've done, as dual axes are high on my list of priorities...
Regards,
DG.
Thanks for sharing your code. I'll be sure to take a look at what you've done, as dual axes are high on my list of priorities...
Regards,
DG.
Re: working 2nd y axis patch
do you have the ValueAxis.java file also, it looks as though you have made changes to that also that are needed to check out the new axis stuff.
Thanks,
Looking forward to checking it out
Stacey
Thanks,
Looking forward to checking it out
Stacey
Re: working 2nd y axis patch
I've just checked the timestamp of this file (both the .java in the source and the .class in the jar file) and I've not touched it
what error messages are you getting?
what error messages are you getting?
Re: working 2nd y axis patch
The y2 patches don't compile cleanly against the latest CVS image. One (of several) errors is in ValueAxis. Only 20 errors though. Some are the recent switch of XxxxAxis() constructor argument order. I'm tempted to dig in an fix them but it could be a waste if more changes occur either in y2 or main fork.
JSG
JSG
Re: working 2nd y axis patch
Hi David
How is work on the official version of y-axis 2 progressing? I will check out Ron's patch - all I need is the drawing of the axis (I scale all my series values to fit the original y-axis), so it will probably be enough.
I've also made a patch to disallow a zero range in any situation - it causes problems when you try and draw. I know there's a minimum auto range setting, but it didn't always work and then actually interfered with my implemented patch (so I removed the option - the minimum is now effectively implemented by the (hard-coded) range alteration). I'm working with 0.9.2 but did check 0.9.3 to ensure I wasn't duplicating effort. Should I send the code to you directly, or is there another procedure? I don't have a site to post to like Ron did and I'm not 100% sure that my implementation is the best even though it works for me.
Regards
TT.
How is work on the official version of y-axis 2 progressing? I will check out Ron's patch - all I need is the drawing of the axis (I scale all my series values to fit the original y-axis), so it will probably be enough.
I've also made a patch to disallow a zero range in any situation - it causes problems when you try and draw. I know there's a minimum auto range setting, but it didn't always work and then actually interfered with my implemented patch (so I removed the option - the minimum is now effectively implemented by the (hard-coded) range alteration). I'm working with 0.9.2 but did check 0.9.3 to ensure I wasn't duplicating effort. Should I send the code to you directly, or is there another procedure? I don't have a site to post to like Ron did and I'm not 100% sure that my implementation is the best even though it works for me.
Regards
TT.