diff --git a/src/main/scala/org/sameersingh/scalaplot/jfreegraph/JFGraphPlotter.scala b/src/main/scala/org/sameersingh/scalaplot/jfreegraph/JFGraphPlotter.scala index f1ffd7e..e9cd34f 100644 --- a/src/main/scala/org/sameersingh/scalaplot/jfreegraph/JFGraphPlotter.scala +++ b/src/main/scala/org/sameersingh/scalaplot/jfreegraph/JFGraphPlotter.scala @@ -2,7 +2,7 @@ package org.sameersingh.scalaplot.jfreegraph import org.sameersingh.scalaplot._ import javax.swing.JFrame -import org.jfree.chart.{JFreeChart => JChart, ChartPanel, ChartFactory} +import org.jfree.chart.{JFreeChart => JChart, ChartPanel, ChartFactory, ChartUtilities} import org.jfree.data.xy.{XYSeries => XYS} import org.jfree.data.xy.XYSeriesCollection import com.itextpdf.text.pdf.DefaultFontMapper @@ -94,6 +94,11 @@ class JFGraphPlotter(chart: Chart) extends Plotter(chart) { out.close } + override def png(directory: String, filenamePrefix: String) { + val filename = directory + filenamePrefix + ".png" + ChartUtilities.saveChartAsPNG(new java.io.File(filename), jchart, 1280, 720) + } + override def gui() { JFGraphPlotter.gui(jchart) } } @@ -135,4 +140,4 @@ object JFGraphPlotter { plotter.gui() } -} \ No newline at end of file +}