-
Bug
-
Resolution: Fixed
-
P4
-
8
-
b104
To reproduce decrease the width by slider at the top
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.chart.PieChart;
import javafx.scene.control.Slider;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
public class JavaCharts extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
ObservableList<PieChart.Data> data;
data = FXCollections.<PieChart.Data>observableArrayList();
for (int i = 0; i < 10; i++) {
data.add(new PieChart.Data("Data item " + i, i * 100));
}
PieChart chart = new PieChart(data);
chart.setTitle("PieChart");
chart.setStyle("-fx-border-color: darkgray;");
chart.setPrefSize(300, 600);
Pane pane = new Pane();
pane.getChildren().add(chart);
Slider slider = new Slider(0, 300, 300);
slider.setShowTickLabels(true);
slider.setShowTickMarks(true);
slider.valueProperty().bindBidirectional(chart.prefWidthProperty());
pane.getChildren().add(slider);
pane.setPrefSize(600, 600);
Scene scene = new Scene(pane, 700, 700);
stage.setScene(scene);
stage.show();
}
}
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.chart.PieChart;
import javafx.scene.control.Slider;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
public class JavaCharts extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
ObservableList<PieChart.Data> data;
data = FXCollections.<PieChart.Data>observableArrayList();
for (int i = 0; i < 10; i++) {
data.add(new PieChart.Data("Data item " + i, i * 100));
}
PieChart chart = new PieChart(data);
chart.setTitle("PieChart");
chart.setStyle("-fx-border-color: darkgray;");
chart.setPrefSize(300, 600);
Pane pane = new Pane();
pane.getChildren().add(chart);
Slider slider = new Slider(0, 300, 300);
slider.setShowTickLabels(true);
slider.setShowTickMarks(true);
slider.valueProperty().bindBidirectional(chart.prefWidthProperty());
pane.getChildren().add(slider);
pane.setPrefSize(600, 600);
Scene scene = new Scene(pane, 700, 700);
stage.setScene(scene);
stage.show();
}
}
- relates to
-
JDK-8118050 [PieChart] legend doesn't fit in controls boundary and confused.
- Closed
-
JDK-8091591 All layout containers should support the case where both width and height are determined with a parameter
- Open