A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
tbardzil
Post
by tbardzil » Sat Aug 09, 2003 2:44 pm
Wondering if the factory method for this chart can be changed slightly. A default box width (10) is currently hardcoded in the constructor of the renderer. I think it would be better to call the default constructor which should result in automatic box width calculation.
Code: Select all
public static JFreeChart createBoxAndWhiskerChart(String title,
String timeAxisLabel,
String valueAxisLabel,
BoxAndWhiskerDataset data,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(10.0); // change to new BoxAndWhiskerRenderer();
XYPlot plot = new XYPlot(data, timeAxis, valueAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
Specifying a fixed box width could still be achieved by modifying the renderer directly.
Tim
-
brownidj
- Posts: 34
- Joined: Tue Jun 17, 2003 12:07 am
-
Contact:
Post
by brownidj » Sun Aug 10, 2003 1:32 pm
Agreed Tim - I am currently making a number of changes which I will submit through RFE. This is one of them - the norm (-1) will automatically fit the available space, as per CandleStick.
I am also ensuring that the outlier coefficient can be set, (and the farout coefficient, for that matter) and providing much better demo data.
Truth be told, I was kind of surprised when DG released this code, as it still requires qutie a bit of work. However, it has motivated me to work on improvments over the next week or so, and, as I said, I will post these in a RFE.
Since I know you expressed an interest, any comments will be most welcome.
David B
-
tbardzil
Post
by tbardzil » Sun Aug 10, 2003 5:28 pm
David,
The one other thing I'd like to be able to control is the drawing of the average. I noticed you added this is per your projects requirements but I'm not sure if I would use that or not. Actually, I was thinking I would do an overlaid chart and drawn a line for the average over the box and whisker plots. So I might like to be able to turn that on / off.
Thanks for the contribution. From the example that I have seen it looks really great!
Tim
-
brownidj
- Posts: 34
- Joined: Tue Jun 17, 2003 12:07 am
-
Contact:
Post
by brownidj » Mon Aug 11, 2003 2:01 am
Again, agreed, Tim.
I have added an additional constructor, sans averages. This should be the default. Otherwise, if the average is not null, it will be drawn as a solid ellipse.
I'm hoping to have the first iteration up on RFE later on today. My next iteration will clean up the way outliers are calculated, perhaps introducing an inner class to handle it all.
BTW, do you agree with my thinking in how to show outliers and farouts?
David
-
david.gilbert
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
-
Contact:
Post
by david.gilbert » Mon Aug 11, 2003 11:01 am
brownidj wrote:Truth be told, I was kind of surprised when DG released this code, as it still requires quite a bit of work.
I hope you didn't mind too much. In my experience, releasing incomplete code (as long as it does something useful, which your code certainly does) is a good way to get feedback.
-
Guest
Post
by Guest » Mon Aug 11, 2003 1:04 pm
Absolutely no problem, David - it is definitely spurring me on! I am beavering away as you read this, and all comments are most welcome. Code can only be better for that.
David
-
tbardzil
Post
by tbardzil » Mon Aug 11, 2003 6:43 pm
I tried this weekend to use the auto box width calcualtion (-1) on the demo chart in the JFreeChart 0.9.11 distribution. I noticed the boxes got
really wide since there were only a dozen or so on the chart. I'm wondering what your thoughts are on having a maxiumem upper bound on the auto width calculation. After a certain point the boxes just look too fat to me
Maybe this could be parameterized rather than hard coding some value in the source? in other words - "I want you to auto calculate the box width but don't go above x pixes".
Tim
-
brownidj
- Posts: 34
- Joined: Tue Jun 17, 2003 12:07 am
-
Contact:
Post
by brownidj » Tue Aug 12, 2003 6:53 am
David, I am wondering what is best to do with the outlier classes which are currently in the renderer package. Seems to be a bit 'untidy'.Would it be better to make them inner classes?
David
-
brownidj
- Posts: 34
- Joined: Tue Jun 17, 2003 12:07 am
-
Contact:
Post
by brownidj » Thu Aug 14, 2003 2:59 pm
I have left some updates for BoxAndWhisker in RFE (788717), mainly along the lines of the discussion above