quartile chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Nishan Krikorian

quartile chart

Post by Nishan Krikorian » Wed May 15, 2002 10:47 pm

Hi,

How do I make a quartile chart? The data values are min, 1st quartile, median, 3rd quartile, max for each category. The chart should look sort of like a floating vertical stacked bar chart (with four colors) or a high/low/open/close chart (with five tics). I tried both ways but didn't get very far. Any suggestions? Has it already been done?

Nish

David Gilbert

Re: quartile chart

Post by David Gilbert » Thu May 16, 2002 6:18 am

Hi Nish,

Is this the 'box and whiskers' chart type where the box defines the lower and upper quartile range, and then there is a horizontal line through the box at the median plus a vertical line extending from the lowest data value to the highest data value? I guess the representation could vary, but I think I've seen this version.

That would be a nice addition to JFreeChart. Because of the special data requirements, I would recommend creating an extension of the CategoryDataset interface (call it something like QuartileCategoryDataset). Next, create a class that implements the interface (DefaultQuartileCategoryDataset). Then you would need to write a class that implements the CategoryItemRenderer interface to actually draw the data items.

One day (when I get time) I'll implement this...but I'll also be hoping that someone else does it sooner.

Regards,

DG.

mike

Quartile Chart

Post by mike » Thu Mar 24, 2005 3:19 pm

Have you added the quartile chart to JFreeChart?

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 » Thu Mar 24, 2005 11:55 pm

Yes, JFreeChart has box-and-whisker plots for both the CategoryPlot and XYPlot classes now.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

nimowy
Posts: 19
Joined: Fri Jan 25, 2008 10:16 pm

Stacked Bar-style quartile chart

Post by nimowy » Fri Jan 25, 2008 10:27 pm

Hi, Is there any way to get something like this:
(nevermind, it won't let me post the link - it's the floating bar chart the guy was talking about - in Excel you plot it something like this: =SERIES(QuartileData!$A$18,QuartileData!$B$13:$E$13,QuartileData!$B$18:$E$18,5), using a column chart)

It is a quartile chart, but they prefer the stacked-bar look, and I can't seem to figure that out.

Also, they have four quartiles and a median rather than three, which seems to be the case with the box and whisker chart.

Even if I could just fake it somehow - this is only benchmark data to go in the background. The real interest would be the overlaid line chart that represents the user's actual responses, which they can then compare to the bar charts in the background.

Thanks! I did by the user's guide and the demo code, it was very helpful, just not quite enough...

nimowy
Posts: 19
Joined: Fri Jan 25, 2008 10:16 pm

Post by nimowy » Fri Jan 25, 2008 10:52 pm

Hi, just to give you more information on it, I did find another charting software (not as cool and open source like jfreechart) that called it a "box chart created by using 4 box layers, each handling one data series"

Perhaps it is not too hard to extend the Box and Whiskers chart to do boxes for the other two instead of whiskers? How would that work?

Or perhaps it would be easier to create a "Floating Bar Chart" where you can set where the bar rendering starts, then the heights of all the bars? Would that be hard?

Thanks,

Pam
Last edited by nimowy on Fri Jan 25, 2008 11:25 pm, edited 1 time in total.

nimowy
Posts: 19
Joined: Fri Jan 25, 2008 10:16 pm

Post by nimowy » Fri Jan 25, 2008 11:21 pm

Hi, one more thing... looking at Box and Whisker, it looks like you have to give it all the raw values, but for my benchmark / comparison data, all I have is the already-calculated quartile ranges, along with the median. No mean available. Does Box and Whisker always rely on calculating this itself?

Thanks!

Pam

nimowy
Posts: 19
Joined: Fri Jan 25, 2008 10:16 pm

Post by nimowy » Thu Jan 31, 2008 8:32 pm

nimowy wrote:Hi, one more thing... looking at Box and Whisker, it looks like you have to give it all the raw values, but for my benchmark / comparison data, all I have is the already-calculated quartile ranges, along with the median. No mean available. Does Box and Whisker always rely on calculating this itself?

Thanks!

Pam
Never mind. I figured out how to set it using a BoxAndWhiskerItem. Thanks anyways.

nimowy
Posts: 19
Joined: Fri Jan 25, 2008 10:16 pm

Post by nimowy » Thu Jan 31, 2008 11:16 pm

nimowy wrote: Or perhaps it would be easier to create a "Floating Bar Chart" where you can set where the bar rendering starts, then the heights of all the bars? Would that be hard?
Hi, I figured out a way to do this. You can set the bottom bar to be the size you need the stacked bar to float. Then set the paint for that series to translucent. This way you can have a Floating Stacked Bar Chart, with each bar floating a different amount.

IE:

Code: Select all

StackedBarRenderer renderer1 = (StackedBarRenderer) plot.getRenderer();
Color transparent = new Color(1,1,1,1);      
renderer1.setSeriesPaint(0, transparent);
And when you make your dataset, be sure to add your "fake" bar first, and don't give the series any name:

Code: Select all

DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(31,"",myTool.getProperty("CATEGORY1"));

Locked