import org.jfree.chart.*
import org.jfree.chart.plot.*
import org.jfree.data.category.*
dcd = new DefaultCategoryDataset()
dcd.with {
addValue(80, "A店", "Jan 2010")
addValue(110, "A店", "Feb 2010")
addValue(120, "A店", "Mar 2010")
addValue(50, "B店", "Jan 2010")
addValue(120, "B店", "Feb 2010")
addValue(80, "B店", "Mar 2010")
}
jfc = ChartFactory.createStackedBarChart(
"売上推移",
"年月",
"売上",
dcd,
PlotOrientation.VERTICAL,
true,
false,
false)
ChartUtilities.saveChartAsPNG(
new File("./stacked-bar-chart.png"), jfc, 300, 200)
出力画像(stacked-bar-chart.png)
動作環境
JDK1.6 Update 15, groovy 1.6.3, JFreeChart1.0.13, JCommon1.0.16
0 件のコメント:
コメントを投稿