Links

« Back to blog

GroovyChart

https://groovychart.dev.java.net/images/first_groovychart.png
 
 
Groovy Builder that simplifies creating charts from the Groovy language. GroovyChart is based on the Groovy builder paradigm, and applies it to the well known JFreeChart library.
 
https://groovychart.dev.java.net/
 
Example code:

import com.thecoderscorner.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();

Posted September 7, 2009 by email 
 
To leave a comment on this posterous, please login by clicking one of the following.
Posterous-login     twitter