/ Published in: Groovy
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// no jfreechart imports required (we'll find them programmatically) import groovy.swing.SwingBuilder // load jars and add to classpath maven.require(groupId:'jfree', artifactId:'jfreechart', version:'1.0.5') maven.require(groupId:'jfree', artifactId:'jcommon', version:'1.0.9') // define used classes/instances programmatically // normal code below here dataset.addValue 150, "no.1", "Jan" dataset.addValue 210, "no.1", "Feb" dataset.addValue 390, "no.1", "Mar" dataset.addValue 300, "no.2", "Jan" dataset.addValue 400, "no.2", "Feb" dataset.addValue 200, "no.2", "Mar" orientationClass.VERTICAL, *options) defaultCloseOperation:EXIT_ON_CLOSE) { panel(id:'canvas') { rigidArea(width:400, height:400) } } frame.pack() frame.show() chart.draw(swing.canvas.graphics, swing.canvas.bounds) } }