This issue came out during the code review https://github.com/openjdk/jfx/pull/1214 (JDK-8283675)
In LineChart, minor ticks in both the axes are not shown with correct resolution, rather it gets concentrated towards the origin as shown in the attached screenshot LineChart.png.
This is observed only when animation is enabled.
(this issue can be seen with any kind of XYChart: area, bar, bubble, line, scatter, stacked area, stacked bar.)
Steps to reproduce the issue:
Run the given example.
Press Add Point button
Observe how minor ticks are spread across the axes.
Expected behavior:
Minor ticks should be of uniform resolution and should be spread across the axis.
Actual behavior:
Minor ticks are concentrated towards the origin.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import java.util.Random;
public class LineChartSample extends Application {
private Random rnd = new Random();
@Override
public void start(Stage stage) throws Exception {
LineChart<Number, Number> lineChart = new LineChart<>(new NumberAxis(), new NumberAxis());
XYChart.Series<Number, Number> series = new XYChart.Series<>();
lineChart.getData().add(series);
Button add = new Button("Add Point");
Button remove = new Button("Remove Point");
add.setOnAction(event -> {
int xValue = rnd.nextInt(100);
int yValue = rnd.nextInt(50);
series.getData().add(0, new XYChart.Data<>(xValue, yValue));
});
remove.setOnAction(event -> {
series.getData().remove(0);
});
stage.setScene(new Scene(new VBox(add, remove, lineChart)));
stage.show();
}
public static void main(String[] args) {
launch();
}
}
---------- END SOURCE ----------
This issue is also observed sometimes when linechart contains data and each point is removed one by one using Remove Point button.
In LineChart, minor ticks in both the axes are not shown with correct resolution, rather it gets concentrated towards the origin as shown in the attached screenshot LineChart.png.
This is observed only when animation is enabled.
(this issue can be seen with any kind of XYChart: area, bar, bubble, line, scatter, stacked area, stacked bar.)
Steps to reproduce the issue:
Run the given example.
Press Add Point button
Observe how minor ticks are spread across the axes.
Expected behavior:
Minor ticks should be of uniform resolution and should be spread across the axis.
Actual behavior:
Minor ticks are concentrated towards the origin.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import java.util.Random;
public class LineChartSample extends Application {
private Random rnd = new Random();
@Override
public void start(Stage stage) throws Exception {
LineChart<Number, Number> lineChart = new LineChart<>(new NumberAxis(), new NumberAxis());
XYChart.Series<Number, Number> series = new XYChart.Series<>();
lineChart.getData().add(series);
Button add = new Button("Add Point");
Button remove = new Button("Remove Point");
add.setOnAction(event -> {
int xValue = rnd.nextInt(100);
int yValue = rnd.nextInt(50);
series.getData().add(0, new XYChart.Data<>(xValue, yValue));
});
remove.setOnAction(event -> {
series.getData().remove(0);
});
stage.setScene(new Scene(new VBox(add, remove, lineChart)));
stage.show();
}
public static void main(String[] args) {
launch();
}
}
---------- END SOURCE ----------
This issue is also observed sometimes when linechart contains data and each point is removed one by one using Remove Point button.
- relates to
-
JDK-8283675 Line not removed from LineChart when series cleared
- Resolved
-
JDK-8334873 [BarChart] Series stop resizing
- Open