The alignment on the category axis doesn't work out all that great in a bar
chart, but this shows how you can group bars under single category labels
using jFreeChart:
<cfscript>
// bar chart
ds = CreateObject("java",
"org.jfree.data.category.DefaultCategoryDataset").init();
ds.addValue(JavaCast("double", 23.0), "Bar 1", "15");
ds.addValue(JavaCast("double", 21.0), "Bar 2", "15");
ds.addValue(JavaCast("double", 25.0), "Bar 3", "15");
ds.addValue(JavaCast("double", 23.0), "Bar 4", "15");
ds.addValue(JavaCast("double", 13.0), "Bar 5", "15");
ds.addValue(JavaCast("double", 23.0), "Bar 1", "10");
ds.addValue(JavaCast("double", 21.0), "Bar 2", "10");
ds.addValue(JavaCast("double", 25.0), "Bar 3", "10");
ds.addValue(JavaCast("double", 23.0), "Bar 4", "10");
ds.addValue(JavaCast("double", 13.0), "Bar 5", "10");
ds.addValue(JavaCast("double", 23.0), "Bar 1", "5");
ds.addValue(JavaCast("double", 21.0), "Bar 2", "5");
ds.addValue(JavaCast("double", 25.0), "Bar 3", "5");
ds.addValue(JavaCast("double", 23.0), "Bar 4", "5");
ds.addValue(JavaCast("double", 13.0), "Bar 5", "5");
ds.addValue(JavaCast("double", 18.0), "Bar 1", "Now");
bc = CreateObject("java",
"org.jfree.chart.ChartFactory").createBarChart("Bar Chart Demo", "Minutes
Ago", "Hits", ds,
CreateObject("java", "org.jfree.chart.plot.PlotOrientation").VERTICAL,
false, true, false);
img = CreateObject("java",
"org.jfree.chart.ChartUtilities").encodeAsPNG(bc.createBufferedImage(600,
400));
</cfscript>
<cfcontent type="image/png" variable="#img#" />
Running example here:
http://mattwoodward.com/demos/jfc-barchart.cfm
--
Matthew Woodward
[email protected]
http://blog.mattwoodward.com
identi.ca/Twitter: @mpwoodward
Please do not send me proprietary file formats such as Word, PowerPoint,
etc. as attachments.
http://www.gnu.org/philosophy/no-word-attachments.html
--
Open BlueDragon Public Mailing List
http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
mailing list - http://groups.google.com/group/openbd?hl=en
!! save a network - please trim replies before posting !!