Skip to content

Instantly share code, notes, and snippets.

@ytoshima
Created January 31, 2014 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ytoshima/8727745 to your computer and use it in GitHub Desktop.
Save ytoshima/8727745 to your computer and use it in GitHub Desktop.
A simple jfreechart sample
name := "First"
version := "0.9"
scalaVersion := "2.10.2"
libraryDependencies += "org.jfree" % "jfreechart" % "1.0.15"
import org.jfree.chart.ChartFactory
import org.jfree.chart.ChartFrame
import org.jfree.chart.JFreeChart
import org.jfree.data.general.DefaultPieDataset
object First extends App {
val data = new DefaultPieDataset
List(("Category 1", 43.2), ("Category 2", 27.9), ("Category 3", 79.5)).
foreach(e => data.setValue(e._1, e._2))
val chart = ChartFactory.createPieChart("Simple Pie Chart",
data, true, // legend
true, // tooltips
false) // URLs
val frame = new ChartFrame("JFreeChart: First.java", chart)
frame.pack()
frame.setVisible(true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment