From 109fc32d912bfc76975ce414c5cb1f551dd43ab4 Mon Sep 17 00:00:00 2001 From: miettinen Date: Thu, 20 Feb 2014 12:52:49 +0000 Subject: [PATCH] The domain axis of JFreeChart trends to start from where the data actually starts instead of forced 0 (refs #4490). Applied also in Sysdyn sensitivity charts. git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@28905 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../src/org/simantics/jfreechart/chart/NumberAxis.java | 1 + .../src/org/simantics/sysdyn/ui/trend/TrendView.java | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/NumberAxis.java b/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/NumberAxis.java index 4f070631..a4216e10 100644 --- a/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/NumberAxis.java +++ b/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/NumberAxis.java @@ -36,6 +36,7 @@ public class NumberAxis extends AbstractAxis { @Override public Axis getAxis() { axis = new ExtendedNumberAxis(); + ((org.jfree.chart.axis.NumberAxis)axis).setAutoRangeIncludesZero(false); ((ExtendedNumberAxis)axis).setLower(min); ((ExtendedNumberAxis)axis).setUpper(max); return super.getAxis(); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java index d3a33699..928d8377 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java @@ -267,9 +267,11 @@ public class TrendView extends ViewPart { */ private void displayDefaultChart() { if(defaultchart == null) { + NumberAxis domainAxis = new NumberAxis("time"); + domainAxis.setAutoRangeIncludesZero(false); XYPlot plot = new XYPlot( sysdynDatasets, - new NumberAxis("time"), + domainAxis, new NumberAxis(""), new XYLineAndShapeRenderer(true, false) ); -- 2.47.1