From d682d5721c19c042ac0191141787f591b5850ce0 Mon Sep 17 00:00:00 2001 From: Riccardo De Benedictis Date: Mon, 9 Apr 2018 12:44:27 +0200 Subject: [PATCH] solved minor issues.. --- .../lecture/desktopapp/StudentController.java | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/LECTurE-DesktopApp/src/main/java/it/cnr/istc/lecture/desktopapp/StudentController.java b/LECTurE-DesktopApp/src/main/java/it/cnr/istc/lecture/desktopapp/StudentController.java index 2b4d0fd..907afab 100644 --- a/LECTurE-DesktopApp/src/main/java/it/cnr/istc/lecture/desktopapp/StudentController.java +++ b/LECTurE-DesktopApp/src/main/java/it/cnr/istc/lecture/desktopapp/StudentController.java @@ -19,9 +19,6 @@ import it.cnr.istc.lecture.api.Parameter; import it.cnr.istc.lecture.desktopapp.Context.ParameterValue; import java.net.URL; -import java.text.FieldPosition; -import java.text.NumberFormat; -import java.text.ParsePosition; import java.util.HashMap; import java.util.IdentityHashMap; import java.util.Map; @@ -39,6 +36,7 @@ import javafx.scene.layout.StackPane; import javafx.util.StringConverter; import org.jfree.chart.JFreeChart; +import org.jfree.chart.axis.DateAxis; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.fx.ChartViewer; import org.jfree.chart.plot.CombinedDomainXYPlot; @@ -103,24 +101,7 @@ private class StudentChartContext { private final ChartViewer viewer; private StudentChartContext(StudentContext ctx) { - final NumberAxis domain_axis = new NumberAxis(""); - domain_axis.setAutoRangeIncludesZero(false); - domain_axis.setNumberFormatOverride(new NumberFormat() { - @Override - public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { - return format((long) number, toAppendTo, pos); - } - - @Override - public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos) { - return toAppendTo.append(TIME_STRING_CONVERTER.toString(number)); - } - - @Override - public Number parse(String source, ParsePosition parsePosition) { - throw new UnsupportedOperationException("Not supported yet."); - } - }); + DateAxis domain_axis = new DateAxis(""); CombinedDomainXYPlot plot = new CombinedDomainXYPlot(domain_axis); plot.setGap(10.0); @@ -132,7 +113,8 @@ public Number parse(String source, ParsePosition parsePosition) { XYSeriesCollection collection = new XYSeriesCollection(); par_collections.put(par.name, collection); par.properties.entrySet().forEach(c_par -> collection.addSeries(new XYSeries(c_par.getKey()))); - NumberAxis range_axis = new NumberAxis(""); + NumberAxis range_axis = new NumberAxis(par.name); + range_axis.setLabelAngle(1.5708); final XYItemRenderer renderer = new StandardXYItemRenderer(); XYPlot c_plot = new XYPlot(collection, null, range_axis, renderer); par_plots.put(par.name, c_plot); @@ -161,7 +143,8 @@ public Number parse(String source, ParsePosition parsePosition) { XYSeriesCollection collection = new XYSeriesCollection(); par_collections.put(par.name, collection); par.properties.entrySet().forEach(c_par -> collection.addSeries(new XYSeries(c_par.getKey()))); - NumberAxis range_axis = new NumberAxis(""); + NumberAxis range_axis = new NumberAxis(par.name); + range_axis.setLabelAngle(1.5708); final XYItemRenderer renderer = new StandardXYItemRenderer(); XYPlot c_plot = new XYPlot(collection, null, range_axis, renderer); par_plots.put(par.name, c_plot);