Duplicate :
|
|
Relates :
|
|
Relates :
|
FULL PRODUCT VERSION : java version "1.8.0_112" Java(TM) SE Runtime Environment (build 1.8.0_112-b16) Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode) ADDITIONAL OS VERSION INFORMATION : Darwin Liams-MacBook-Pro.local 14.5.0 Darwin Kernel Version 14.5.0: Sun Sep 25 22:07:15 PDT 2016; root:xnu-2782.50.9~1/RELEASE_X86_64 x86_64 A DESCRIPTION OF THE PROBLEM : The attached program displays the LineChart in red on Java 8 update 101 and below. If I use Java 8 update 102 or later (I've tried 111 and 112) the line is black. REGRESSION. Last worked in version 8u101 ADDITIONAL REGRESSION INFORMATION: java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode) STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Run the attached program and look at the colour of the LineChart. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The Line Chart should be red. ACTUAL - The Line Chart is black. REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public class GraphColorIssue extends Application { private LineChart<Number, Number> mLineChart = new LineChart<>(new NumberAxis(), new NumberAxis()); private int mTime = 1; private GridPane mGridPane; public static void main(String[] args) { launch(args); } @Override public void start( final Stage primaryStage) throws Exception { mGridPane = new GridPane(); mGridPane.add(mLineChart, 1, 1); mGridPane.setMinWidth(300); mGridPane.setMinHeight(300); final Scene scene = new Scene(mGridPane); primaryStage.setScene(scene); primaryStage.show(); simulateASyncGraphDataUpdate(); } private void scheduleDataLoad() { final Timeline timeline = new Timeline(new KeyFrame( javafx.util.Duration.seconds(1), ae -> simulateASyncGraphDataUpdate())); timeline.play(); } public void simulateASyncGraphDataUpdate() { setGridContents(0, new Label("Loading...")); final Timeline timeline = new Timeline(new KeyFrame( javafx.util.Duration.seconds(1), ae -> simulateDataReady())); timeline.play(); } private void simulateDataReady() { updateLineChartData(); setGridContents(0, mLineChart); scheduleDataLoad(); } private void updateLineChartData() { // Comment this line in and you'll get colors. //mLineChart = new LineChart<>(new NumberAxis(), new NumberAxis()); mLineChart.setTitle("Line Chart Color Issue - using Java " + System.getProperty("java.version")); ++mTime; final Series<Number, Number> series = new Series<>(); for (int x = 0; x < mTime; x++) { final XYChart.Data<Number, Number> dataPoint = new XYChart.Data<>(x, 5); series.getData().add(dataPoint); } mLineChart.getData().clear(); mLineChart.getData().add(series); } private void setGridContents( final int index, final Node node) { mGridPane.getChildren().set(index, node); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Use a new mLineChart instance each time - uncomment first line in updateLineChartData() method to see.
|