I have been using JFreeChart and webobjects now for a couple of years, producing some nice bar charts. They make a good combination, and for those of you wondering, buying the manual is very much worth it.
But, I need to add polar plots now and I need to change the way JFreeChart renders the polar plot, but I am unsure how to proceed.
The changes I am looking for are:
1) Have 0 and 180 horizontal on the plot
2) Have the range axis zero-centered on the plot
Any suggestions? Thanks in advance,
David
Polar Plot help needed
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Polar Plot help needed
I didn't write this class, but...
The starting angle is hard-coded in the translateValueThetaRadiusToJava2D() method in the PolarPlot class. It's probably pretty straightforward to make it a user-configurable setting, but I didn't look closely to see if there is anything else that needs updating.daress wrote:1) Have 0 and 180 horizontal on the plot
Retrieve the plot's axis and call setAutoRangeIncludesZero(true) --- you'll need to cast from ValueAxis to NumberAxis to access that method.daress wrote:2) Have the range axis zero-centered on the plot
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
Re: Polar Plot help needed
Thanks for the help.
Any futher hints? Thanks for the suggestions.
David
I am looking into this one. Basically subclassing off of PolarPlot to make a new class.david.gilbert wrote:The starting angle is hard-coded in the translateValueThetaRadiusToJava2D() method in the PolarPlot class. It's probably pretty straightforward to make it a user-configurable setting, but I didn't look closely to see if there is anything else that needs updating.
But this is not working for what I want. I have data that is mostly around -7 to -7.5. I want the range axis to span from say +7.5 to -7.5 with 0 being centered on the polar plot.david.gilbert wrote:Retrieve the plot's axis and call setAutoRangeIncludesZero(true) --- you'll need to cast from ValueAxis to NumberAxis to access that method.
Any futher hints? Thanks for the suggestions.
David
-
- Posts: 3
- Joined: Wed Feb 27, 2008 7:00 pm
Opposite Problem
I have exactly the opposite problem. I don't want my plot zero-centered, but I can't seem to stop it. I can't find setAutoRangeIncludesZero for the axis (polarPlot.getAxis()), so I can't set it to false. My data is entirely from 0-90 degrees with a radius from 10-50. While the plot is nicely centered on 0, my data is squashed in the upper right quadrant.
Zooming produces its own problems. Using the mouse, I can't zoom properly. Rubber-banding around 0-15 in the radius (the equivalent of the X axis, since the "Y" direction is fixed at the full height of the plot) produces a plot centered at 0 with a radius from 0-25 (not 15 as I selected) with my data is plotted half outside the plotting area. I would like to plot just the area where the data is. And I would like to be able to zoom in using the mouse just as I do for XY plots.
Zooming produces its own problems. Using the mouse, I can't zoom properly. Rubber-banding around 0-15 in the radius (the equivalent of the X axis, since the "Y" direction is fixed at the full height of the plot) produces a plot centered at 0 with a radius from 0-25 (not 15 as I selected) with my data is plotted half outside the plotting area. I would like to plot just the area where the data is. And I would like to be able to zoom in using the mouse just as I do for XY plots.