This commit is contained in:
Jörg Prante 2021-11-15 23:28:01 +01:00
parent d79e19c005
commit 7697ac95a7
2 changed files with 24 additions and 6 deletions

View file

@ -1,9 +1,9 @@
group = org.xbib.graphics group = org.xbib.graphics
name = graphics name = graphics
version = 4.0.4 version = 4.0.5
gradle.wrapper.version = 6.6.1 gradle.wrapper.version = 6.6.1
pdfbox.version = 2.0.23 pdfbox.version = 2.0.24
jna.version = 5.8.0 jna.version = 5.8.0
zxing.version = 3.3.1 zxing.version = 3.3.1
reflections.version = 0.9.11 reflections.version = 0.9.11

View file

@ -33,16 +33,20 @@ public abstract class AxesChartSeriesNumericalNoErrorBars extends MarkerSeries {
@Override @Override
protected void calculateMinMax() { protected void calculateMinMax() {
List<Double> xMinMax = findMinMax(xData); List<Double> xMinMax = findMinMax(xData);
setXMin(xMinMax.get(0)); if (xMinMax != null) {
setXMax(xMinMax.get(1)); setXMin(xMinMax.get(0));
setXMax(xMinMax.get(1));
}
List<Double> yMinMax; List<Double> yMinMax;
if (extraValues == null) { if (extraValues == null) {
yMinMax = findMinMax(yData); yMinMax = findMinMax(yData);
} else { } else {
yMinMax = findMinMaxWithErrorBars(yData, extraValues); yMinMax = findMinMaxWithErrorBars(yData, extraValues);
} }
setYMin(yMinMax.get(0)); if (yMinMax != null) {
setYMax(yMinMax.get(1)); setYMin(yMinMax.get(0));
setYMax(yMinMax.get(1));
}
} }
List<Double> findMinMax(List<?> data) { List<Double> findMinMax(List<?> data) {
@ -82,6 +86,20 @@ public abstract class AxesChartSeriesNumericalNoErrorBars extends MarkerSeries {
if (bd.doubleValue() > max) { if (bd.doubleValue() > max) {
max = bd.doubleValue(); max = bd.doubleValue();
} }
} else if (dataPoint instanceof Long) {
long i = (Long) dataPoint;
if (min == null) {
min = (double) i;
}
if (max == null) {
max = (double) i;
}
if (i < min) {
min = (double) i;
}
if (i > max) {
max = (double) i;
}
} else if (dataPoint instanceof Integer) { } else if (dataPoint instanceof Integer) {
int i = (Integer) dataPoint; int i = (Integer) dataPoint;
if (min == null) { if (min == null) {