// Requires : org.swinglabs#swingx-core;1.6.2-2

class Graph(f: Double => Double) extends org.jdesktop.swingx.JXGraph.Plot {
  def compute(x: Double) = f(x)
}
object Graph {
  def apply(fs: (Double => Double)*) = fs.map(new Graph(_)).toArray
}

Graph(x => x*x, x => x*x*x)
/*
0; 0-1,2-1-0,8-0,6-0,4-0,20,20,40,60,811,2-1,2-1-0,8-0,6-0,4-0,20,20,40,60,811,2
*/