blog rss feed

Progress with GroovyChart - the JFreeChart builder for Groovy

Author: Dave Cherry last modified
Keywords: groovy jfreechart

Its been several weeks since I last discussed wrapping JFreeChart in Groovy. Although I've been quiet - there is some good news. I have taken the java.net project groovychart and started to develop on top of it. Although this implementation is currently in Java; which means its more complex than it may have been in Groovy because of Java's strong typing, it is very comprehensive in its coverage.

Yesterday, I sent a mail to the community manager at java.net, asking for permission to work on the project. This is really needed as without this I would have to take a cut of whats there and move it to another host - I dont really want to do that.

Since I last blogged, I have got hold of the source from java.net, done some major refactoring of the way builders are stacked, then got it all working again. I also added pie chart support (my favourite chart).

Here's an example:

import net.java.dev.groovychart.chart.ChartBuilder
import groovy.swing.SwingBuilder
import java.awt.BorderLayout as BL
import javax.swing.JFrame
import java.awt.Color
import java.awt.Dimension
import org.jfree.chart.ChartPanel

ChartBuilder cb = new ChartBuilder();
def pieChart = cb.piechart3d(title: "Simple Pie Chart") {
defaultPieDataset {
Series1(40.0f)
Series2(30.0f)
Series3(30.0f)
}
antiAlias = true
backgroundPaint(Color.WHITE)
}

def sb = new SwingBuilder()
def fr = sb.frame( title : 'Simple Pie Chart', size:[600, 400],
defaultCloseOperation: JFrame.EXIT_ON_CLOSE) {
widget(new ChartPanel(pieChart.chart), constraints: BL.CENTER)
}
fr.pack();
fr.show();

And this code produced:

first attempt from groovychart

Ignore the "defaultPieDataset" in the chart, a fix for this is in progress.

Getting the source

Hopefully, I will get a reply from java.net soon, once I do I will commit my changes for inspection / download. However, if this does not happen within the next day or so, I will make the changes available as a zip on this website.

Comments [1]

On 17-Mar-2008 17:24,  SM wrote:

Why not put it up on code.google.com, if you are not getting replies from java.net?

Please leave a comment



Search

Blog calendar

blog: previous month September 2010 blog: next month
su mo tu we th fr sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30