From 92a6d47a0d7404d30096f2597a1a782b712fb173 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=BCrgen=20Walter?= <juergen.walter@uni-wuerzburg.de>
Date: Fri, 13 Apr 2018 17:36:25 +0200
Subject: [PATCH] fixed histogram

---
 .../descartes/pavo/types/Historgram.java      | 31 +++++--------------
 1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/tools.descartes.pavo/src/tools/descartes/pavo/types/Historgram.java b/tools.descartes.pavo/src/tools/descartes/pavo/types/Historgram.java
index ad29e3d9..1c045d89 100644
--- a/tools.descartes.pavo/src/tools/descartes/pavo/types/Historgram.java
+++ b/tools.descartes.pavo/src/tools/descartes/pavo/types/Historgram.java
@@ -53,13 +53,11 @@ import tools.descartes.pavo.result.ResultContainerPavo;
 import tools.descartes.pavo.result.SeriesResultPavo;
 
 /**
- * Class to visualise the current result as Histogram if possible. Can visualise
- * results constiting only out of series results. If the y axis descrition is
- * "Frequency" the y values will be used as count for the x values. Removing the
+ * Class to visualize the current series results as histogram. Removes the
  * confidence button and adding a spinner for the choice of number of bins
- * buttons
  * 
- * @author Maximilian König <max.c.koenig@t-online.de>
+ * @author Jürgen Walter <juergen.walter@uni-wuerzburg.de>
+ * @author Maximilian König <max.c.koenig@t-online.de>
  * @since 2016
  */
 public class Historgram extends AbstractVisualizationType implements IVisualizationType {
@@ -84,24 +82,11 @@ public class Historgram extends AbstractVisualizationType implements IVisualizat
 		for (AbstractQuantitativeResult r : this.getResult().getResults()) {
 			if (r instanceof SeriesResultPavo) {
 				LinkedList<Double> list = new LinkedList<>();
-				if (r.getScaleY().equals("Frequency")) {
-
-					for (int j = 0; j < ((SeriesResultPavo) r).getValues().size(); j++) {
-						Double a = ((SeriesResultPavo) r).getValues().get(j).getY();
-						while (a > 0) {
-
-							list.add(((SeriesResultPavo) r).getValues().get(j).getX());
-							a--;
-						}
-
-					}
-				} else {
-					for (int i = 0; i < ((SeriesResultPavo) r).getValues().size(); i++) {
-						list.add(((SeriesResultPavo) r).getValues().get(i).getX());
-
-					}
+				for (int i = 0; i < ((SeriesResultPavo) r).getValues().size(); i++) {
+					list.add(((SeriesResultPavo) r).getValues().get(i).getY());
 
 				}
+
 				double[] array = new double[list.size()];
 				for (int i = 0; i < list.size(); i++) {
 					array[i] = list.get(i); // Watch out for
@@ -111,8 +96,8 @@ public class Historgram extends AbstractVisualizationType implements IVisualizat
 			}
 		}
 
-		String xaxis = this.getXDescription();
-		String yaxis = this.getYDescription();
+		String xaxis = this.getYDescription();
+		String yaxis = "Frequency";
 		JFreeChart chart = ChartFactory.createHistogram("", xaxis, yaxis, dataset, PlotOrientation.VERTICAL, false,
 				false, false);
 		XYPlot plot = (XYPlot) chart.getPlot();
-- 
GitLab