A pie chart using jFreeChart
Source code name: "canvas2D_chart_pie.groovy"
Programming language: Groovy
Topic: Plots/2D
DMelt Version 1. Last modified: 07/06/2015. License: Free
https://datamelt.org/code/cache/canvas2D_chart_pie_2022.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()