From c0401e94b5eb23f0fd88be2d9165fbc9d5abd270 Mon Sep 17 00:00:00 2001 From: erik Date: Sun, 20 Sep 2009 18:39:05 +0000 Subject: [PATCH] --- gps/src/main/java/org/wamblee/gpx/GpxPlotter.java | 2 +- gps/src/main/java/org/wamblee/gpx/TrackStatistics.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gps/src/main/java/org/wamblee/gpx/GpxPlotter.java b/gps/src/main/java/org/wamblee/gpx/GpxPlotter.java index 232c7013..3056eff5 100644 --- a/gps/src/main/java/org/wamblee/gpx/GpxPlotter.java +++ b/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/gps/src/main/java/org/wamblee/gpx/TrackStatistics.java b/gps/src/main/java/org/wamblee/gpx/TrackStatistics.java index 42c2039e..0d054a41 100644 --- a/gps/src/main/java/org/wamblee/gpx/TrackStatistics.java +++ b/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) { -- 2.31.1