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

bug fix in calculating min max - the min was set to Double.MIN and it should have been -Double.MAX

parent 389b49eb
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ public class ScatterChart01 implements ExampleChart { ...@@ -53,7 +53,7 @@ public class ScatterChart01 implements ExampleChart {
int size = 1000; int size = 1000;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
xData.add(random.nextGaussian()); xData.add(random.nextGaussian());
yData.add(-100 + random.nextGaussian()); yData.add(-1000000 + random.nextGaussian());
} }
// Create Chart // Create Chart
......
...@@ -107,7 +107,7 @@ public class Series { ...@@ -107,7 +107,7 @@ public class Series {
private double[] findMinMax(Collection<?> data, AxisType axisType) { private double[] findMinMax(Collection<?> data, AxisType axisType) {
double min = Double.MAX_VALUE; double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE; double max = -Double.MAX_VALUE;
for (Object dataPoint : data) { for (Object dataPoint : data) {
...@@ -119,7 +119,6 @@ public class Series { ...@@ -119,7 +119,6 @@ public class Series {
if (axisType == AxisType.Number) { if (axisType == AxisType.Number) {
value = ((Number) dataPoint).doubleValue(); value = ((Number) dataPoint).doubleValue();
} }
else if (axisType == AxisType.Date) { else if (axisType == AxisType.Date) {
Date date = (Date) dataPoint; Date date = (Date) dataPoint;
...@@ -148,7 +147,7 @@ public class Series { ...@@ -148,7 +147,7 @@ public class Series {
private double[] findMinMaxWithErrorBars(Collection<? extends Number> data, Collection<? extends Number> errorBars) { private double[] findMinMaxWithErrorBars(Collection<? extends Number> data, Collection<? extends Number> errorBars) {
double min = Double.MAX_VALUE; double min = Double.MAX_VALUE;
double max = Double.MIN_VALUE; double max = -Double.MAX_VALUE;
Iterator<? extends Number> itr = data.iterator(); Iterator<? extends Number> itr = data.iterator();
Iterator<? extends Number> ebItr = errorBars.iterator(); Iterator<? extends Number> ebItr = errorBars.iterator();
......
...@@ -89,7 +89,7 @@ public class Axis implements ChartPart { ...@@ -89,7 +89,7 @@ public class Axis implements ChartPart {
void resetMinMax() { void resetMinMax() {
min = Double.MAX_VALUE; min = Double.MAX_VALUE;
max = Double.MIN_VALUE; max = -Double.MAX_VALUE;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment