diff -r 8cc538c3a7f8 modules/controls/src/main/java/javafx/scene/chart/StackedAreaChart.java --- a/modules/controls/src/main/java/javafx/scene/chart/StackedAreaChart.java Wed Jul 02 13:17:41 2014 +0200 +++ b/modules/controls/src/main/java/javafx/scene/chart/StackedAreaChart.java Wed Jul 02 15:18:14 2014 +0200 @@ -530,7 +530,7 @@ // now copy actual data of the current series. for(Data item = series.begin; item != null; item = item.next) { DataPointInfo itemInfo = new DataPointInfo<>(item, item.getXValue(), - (Number)item.getYValue(), PartOf.CURRENT); + item.getYValue(), PartOf.CURRENT); aggregateData.add(itemInfo); } DoubleProperty seriesYAnimMultiplier = seriesYMultiplierMap.get(series); @@ -542,7 +542,7 @@ // Sort data points from prev and current series sortAggregateList(aggregateData); - ValueAxis yAxis = (ValueAxis)getYAxis(); + Axis yAxis = getYAxis(); Axis xAxis = getXAxis(); boolean firstCurrent = false; boolean lastCurrent = false; @@ -550,10 +550,11 @@ int lastCurrentIndex = findPreviousCurrent(aggregateData, aggregateData.size()); double basePosition = yAxis.getZeroPosition(); if (Double.isNaN(basePosition)) { - if (yAxis.getLowerBound() > 0) { - basePosition = yAxis.getDisplayPosition(yAxis.getLowerBound()); + ValueAxis valueYAxis = (ValueAxis) yAxis; + if (valueYAxis.getLowerBound() > 0) { + basePosition = valueYAxis.getDisplayPosition(valueYAxis.getLowerBound()); } else { - basePosition = yAxis.getDisplayPosition(yAxis.getUpperBound()); + basePosition = valueYAxis.getDisplayPosition(valueYAxis.getUpperBound()); } } // Iterate over the aggregate data : this process accumulates data points @@ -576,21 +577,21 @@ item = new Data(dataInfo.x, 0); x = xAxis.getDisplayPosition(item.getCurrentX()); y = basePosition; - addDropDown(currentSeriesData, item, item.getXValue(), (Number) item.getYValue(), x, y); + addDropDown(currentSeriesData, item, item.getXValue(), item.getYValue(), x, y); } // And add current point. item = dataInfo.dataItem; x = xAxis.getDisplayPosition(item.getCurrentX()); y = yAxis.getDisplayPosition( - yAxis.toRealValue(yAxis.toNumericValue((Number)item.getCurrentY()) * seriesYAnimMultiplier.getValue())); - addPoint(currentSeriesData, item, item.getXValue(), (Number) item.getYValue(), x, y, + yAxis.toRealValue(yAxis.toNumericValue(item.getCurrentY()) * seriesYAnimMultiplier.getValue())); + addPoint(currentSeriesData, item, item.getXValue(), item.getYValue(), x, y, PartOf.CURRENT, false, (firstCurrent) ? false : true); if (dataIndex == lastCurrentIndex) { // need to add drop down point item = new Data(dataInfo.x, 0); x = xAxis.getDisplayPosition(item.getCurrentX()); y = basePosition; - addDropDown(currentSeriesData, item, item.getXValue(), (Number) item.getYValue(), x, y); + addDropDown(currentSeriesData, item, item.getXValue(), item.getYValue(), x, y); } } else { prevPoint = aggregateData.get(pIndex); @@ -604,10 +605,10 @@ } if (prevPoint.x.equals(dataInfo.x)) { // simply add x = xAxis.getDisplayPosition(item.getCurrentX()); - final double yv = yAxis.toNumericValue((Number) item.getCurrentY()) + yAxis.toNumericValue(prevPoint.y); + final double yv = yAxis.toNumericValue(item.getCurrentY()) + yAxis.toNumericValue(prevPoint.y); y = yAxis.getDisplayPosition( yAxis.toRealValue(yv * seriesYAnimMultiplier.getValue())); - addPoint(currentSeriesData, item, dataInfo.x, yv, x, y, PartOf.CURRENT, false, + addPoint(currentSeriesData, item, dataInfo.x, yAxis.toRealValue(yv), x, y, PartOf.CURRENT, false, (firstCurrent) ? false : true); } if (lastCurrent) { @@ -618,7 +619,7 @@ nextPoint = (nIndex == -1) ? null : aggregateData.get(nIndex); prevPoint = (pIndex == -1) ? null : aggregateData.get(pIndex); x = xAxis.getDisplayPosition(item.getCurrentX()); - final double yValue = yAxis.toNumericValue((Number) item.getCurrentY()); + final double yValue = yAxis.toNumericValue(item.getCurrentY()); if (prevPoint != null && nextPoint != null) { double displayY = interpolate(prevPoint.displayX, prevPoint.displayY, nextPoint.displayX, nextPoint.displayY, x); @@ -634,7 +635,7 @@ } y = yAxis.getDisplayPosition(yAxis.toRealValue((yValue + dataY) * seriesYAnimMultiplier.getValue())); // Add the current point - addPoint(currentSeriesData, item, dataInfo.x, yValue + dataY, x, y, PartOf.CURRENT, false, + addPoint(currentSeriesData, item, dataInfo.x, yAxis.toRealValue(yValue + dataY), x, y, PartOf.CURRENT, false, (firstCurrent) ? false : true); if (dataIndex == lastCurrentIndex) { // add drop down point @@ -681,7 +682,7 @@ final double yv = yAxis.toNumericValue(dataInfo.y) + dataY; y = yAxis.getDisplayPosition( yAxis.toRealValue(yv * seriesYAnimMultiplier.getValue())); - addPoint(currentSeriesData, new Data(dataInfo.x, dataY), dataInfo.x, yv, x, y, PartOf.CURRENT, true, true); + addPoint(currentSeriesData, new Data(dataInfo.x, dataY), dataInfo.x, yAxis.toRealValue(yv), x, y, PartOf.CURRENT, true, true); } } } @@ -726,13 +727,13 @@ } // end of out for loop } - private void addDropDown(ArrayList> currentSeriesData, Data item, X xValue, Number yValue, double x, double y) { + private void addDropDown(ArrayList> currentSeriesData, Data item, X xValue, Y yValue, double x, double y) { DataPointInfo dropDownDataPoint = new DataPointInfo<>(true); dropDownDataPoint.setValues(item, xValue, yValue, x, y, PartOf.CURRENT, true, false); currentSeriesData.add(dropDownDataPoint); } - private void addPoint(ArrayList> currentSeriesData, Data item, X xValue, Number yValue, double x, double y, PartOf partof, + private void addPoint(ArrayList> currentSeriesData, Data item, X xValue, Y yValue, double x, double y, PartOf partof, boolean symbol, boolean lineTo) { DataPointInfo currentDataPoint = new DataPointInfo<>(); currentDataPoint.setValues(item, xValue, yValue, x, y, partof, symbol, lineTo); @@ -837,7 +838,7 @@ */ final static class DataPointInfo { X x; - Number y; + Y y; double displayX; double displayY; Data dataItem; @@ -849,7 +850,7 @@ //----- Constructors -------------------- DataPointInfo() {} - DataPointInfo(Data item, X x, Number y, PartOf partOf) { + DataPointInfo(Data item, X x, Y y, PartOf partOf) { this.dataItem = item; this.x = x; this.y = y; @@ -860,7 +861,7 @@ this.dropDown = dropDown; } - void setValues(Data item, X x, Number y, double dx, double dy, + void setValues(Data item, X x, Y y, double dx, double dy, PartOf partOf, boolean skipSymbol, boolean lineTo) { this.dataItem = item; this.x = x; @@ -876,7 +877,7 @@ return x; } - public final Number getY() { + public final Y getY() { return y; } }