From: erik Date: Sun, 20 Sep 2009 18:39:05 +0000 (+0000) Subject: (no commit message) X-Git-Tag: wamblee-utils-0.2@603~59 X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;h=4328c0e6fc748c96904465265a858adb46f9585f;p=utils --- diff --git a/trunk/gps/src/main/java/org/wamblee/gpx/GpxPlotter.java b/trunk/gps/src/main/java/org/wamblee/gpx/GpxPlotter.java index 232c7013..3056eff5 100644 --- a/trunk/gps/src/main/java/org/wamblee/gpx/GpxPlotter.java +++ b/trunk/gps/src/main/java/org/wamblee/gpx/GpxPlotter.java @@ -57,7 +57,7 @@ public class GpxPlotter { Track track = parser.parse(new FileInputStream(file)); TrackStatistics profile = new TrackStatistics(track); - profile.writeHeightProfileJpg(new FileOutputStream("x.jpg"), 600, 300); + profile.writeHeightProfilePng(new FileOutputStream("x.png"), 600, 300); List> elevationProfile = computeElevationProfile(track); printTrack(elevationProfile); diff --git a/trunk/gps/src/main/java/org/wamblee/gpx/TrackStatistics.java b/trunk/gps/src/main/java/org/wamblee/gpx/TrackStatistics.java index 42c2039e..0d054a41 100644 --- a/trunk/gps/src/main/java/org/wamblee/gpx/TrackStatistics.java +++ b/trunk/gps/src/main/java/org/wamblee/gpx/TrackStatistics.java @@ -1,5 +1,6 @@ package org.wamblee.gpx; +import java.awt.Color; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -26,7 +27,7 @@ public class TrackStatistics implements Serializable { _track = aTrack; } - public void writeHeightProfileJpg(OutputStream aStream, int aWidth, int aHeight) throws IOException { + public void writeHeightProfilePng(OutputStream aStream, int aWidth, int aHeight) throws IOException { List> data = computeElevationProfile(); XYSeriesCollection dataset = createDataset(data, "height"); JFreeChart chart = ChartFactory.createXYLineChart( @@ -38,7 +39,8 @@ public class TrackStatistics implements Serializable { true, true, false); - ChartUtilities.writeChartAsJPEG(aStream, chart, aWidth, aHeight); + chart.setBackgroundPaint(Color.WHITE); + ChartUtilities.writeChartAsPNG(aStream, chart, aWidth, aHeight); } private static XYSeriesCollection createDataset(List> aHeightProfile, String aName) {