Skip to content
Snippets Groups Projects
Commit f37617da authored by Tim Molter's avatar Tim Molter
Browse files

Merge pull request #96 from hwaipy/develop

BUG-FIX Histogram
parents b05a0f3a 8ceadc51
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,7 @@ public class Histogram { ...@@ -45,7 +45,7 @@ public class Histogram {
this.numBins = numBins; this.numBins = numBins;
this.originalData = data; this.originalData = data;
Double tempMax = Double.MIN_VALUE; Double tempMax = -Double.MAX_VALUE;
Double tempMin = Double.MAX_VALUE; Double tempMin = Double.MAX_VALUE;
for (Number number : data) { for (Number number : data) {
double value = number.doubleValue(); double value = number.doubleValue();
......
...@@ -16,9 +16,7 @@ ...@@ -16,9 +16,7 @@
package com.xeiam.xchart; package com.xeiam.xchart;
import static org.fest.assertions.api.Assertions.assertThat; import static org.fest.assertions.api.Assertions.assertThat;
import java.util.Arrays; import java.util.Arrays;
import org.junit.Test; import org.junit.Test;
/** /**
...@@ -39,6 +37,16 @@ public class HistogramTest { ...@@ -39,6 +37,16 @@ public class HistogramTest {
// Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).build(); // Chart chart = new ChartBuilder().chartType(ChartType.Bar).width(800).height(600).build();
// chart.addSeries("histogram 1", histogram.getxAxisData(), histogram.getyAxisData()); // chart.addSeries("histogram 1", histogram.getxAxisData(), histogram.getyAxisData());
// new SwingWrapper(chart).displayChart(); // new SwingWrapper(chart).displayChart();
}
@Test
public void testNegetiveValues() {
Histogram histogram = new Histogram(Arrays.asList(-1, -2, -3, -4, -5, -6), 3);
assertThat(histogram.getMax()).isEqualTo(-1);
assertThat(histogram.getMin()).isEqualTo(-6);
assertThat(histogram.getNumBins()).isEqualTo(3);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment