}
yAxeRange.min= Double.POSITIVE_INFINITY;
yAxeRange.max= Double.NEGATIVE_INFINITY;
for(int i=0; i < curves.size(); i++) {
CurveShape curveShape = (CurveShape)curves.get(i);
AxeRange xAxerange = getCurve(curveShape).secondaryXaxis? axesLimitsArray[SX] : axesLimitsArray[PX];
boolean useYdataMinandMax = canUseCurveSourcesMinMax(xAxerange, curveShape);
try {
// When curve X range is not included into current X axis range, we have to compute the curve Y range related to X axis range
if (!useYdataMinandMax) {
curveShape.computeYLocalRange(xAxerange.min, xAxerange.max);
double curveYmin = curveShape.getLocalRangeMinPoint().y;
double curveYmax = curveShape.getLocalRangeMaxPoint().y;
if (curveYmin < yAxeRange.min) {
yAxeRange.min = curveYmin;
}
if (curveYmax > yAxeRange.max) {
yAxeRange.max = curveYmax;
}
}
} catch (DataException e) {
useYdataMinandMax = true;
}
// When curve X range is included into current X axis range, we can direct get curve Y mon and max from data source
try {
if (useYdataMinandMax) {
DataSource currentYSource = curveShape.getYSource();
double candidateMin = currentYSource.getDoubleMin();
double candidateMax = currentYSource.getDoubleMax();
if (candidateMin < yAxeRange.min){
yAxeRange.min = candidateMin;
}
if (candidateMax > yAxeRange.max){
yAxeRange.max = candidateMax;
}
}
// Update format
if (format!=null && !format.equals(curveShape.getYSource().getChoiceFormat())){
format = null;
}
} catch (DataException e) {
useYdataMinandMax = true;