Polar Plot help needed

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
daress
Posts: 23
Joined: Tue Mar 13, 2007 4:52 pm
Contact:

Polar Plot help needed

Post by daress » Tue Mar 13, 2007 4:59 pm

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

david.gilbert
JFreeChart Project Leader
Posts: 11699
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Polar Plot help needed

Post by david.gilbert » Wed Mar 14, 2007 3:59 pm

I didn't write this class, but...
daress wrote:1) Have 0 and 180 horizontal on the plot
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:2) Have the range axis zero-centered 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.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited

daress
Posts: 23
Joined: Tue Mar 13, 2007 4:52 pm
Contact:

Re: Polar Plot help needed

Post by daress » Tue Mar 20, 2007 8:31 pm

Thanks for the help.
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.
I am looking into this one. Basically subclassing off of PolarPlot to make a new class.
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.
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.

Any futher hints? Thanks for the suggestions.

David

ReneGibson
Posts: 3
Joined: Wed Feb 27, 2008 7:00 pm

Opposite Problem

Post by ReneGibson » Wed Feb 27, 2008 7:35 pm

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.

Post Reply