A pie chart using jFreeChart
Code: "canvas2D_chart_pie.groovy" Language: Groovy
DMelt Version 1. Last modified: 07/05/2015. License: Free
http://jwork.org/dmelt/gallery/cache/canvas2D_chart_pie_6211.groovy
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.



import org.jfree.chart.ChartFactory
import org.jfree.data.general.DefaultPieDataset
import java.awt.*
import jhplot.HPlotChart

def piedataset = new DefaultPieDataset();
piedataset.with {
     setValue "Apr", 10
     setValue "May", 30
     setValue "June", 40
}
def options = [true, true, true]
def chart = ChartFactory.createPieChart("Pie Chart",
    piedataset, *options)
chart.backgroundPaint = Color.white
def c1 = new HPlotChart( chart )
c1.visible()