javafx.scene.chart.BarChart#setData ( )源码实例Demo

下面列出了javafx.scene.chart.BarChart#setData ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: strangefx   文件: Renderer.java
public static void renderMeasuredProbabilities(int[] results) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    BarChart<String, Integer> barChart = new BarChart(xAxis, yAxis);
    barChart.setData(getChartData(results));
    barChart.setTitle("Measured probability distribution");
    StackPane root = new StackPane();
    root.getChildren().add(barChart);
    if (myStage != null) {
        Scene oldscene = myStage.getScene();
        VBox box = (VBox)(oldscene.getRoot());
        oldscene.setRoot(new StackPane());
        box.getChildren().add(root);
        Scene newScene = new Scene(box);
        newScene.getStylesheets().add(Main.class.getResource("/styles.css").toExternalForm());
        myStage.setScene(newScene);
    } else {
        Stage stage = new Stage();
        stage.setScene(new Scene(root, 640, 480));
        stage.show();
    }

}
 
源代码2 项目: quantumjava   文件: Main.java
private static void showResults(int[] results) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    BarChart<String, Integer> barChart = new BarChart(xAxis, yAxis);
    barChart.setData(getChartData(results));
    barChart.setTitle("Classic probability distribution");
    StackPane root = new StackPane();
    root.getChildren().add(barChart);
    Stage stage = new Stage();
    stage.setTitle("Two coins, classic case");
    stage.setScene(new Scene(root, 640, 480));
    stage.show();
}
 
源代码3 项目: quantumjava   文件: MainWindow.java
@Override
public void start(Stage stage) throws Exception {
    int results[] = TwoCoins.calculate(count);
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    BarChart<String, Integer> barChart = new BarChart(xAxis, yAxis);
    barChart.setData(getChartData(results));
    StackPane root = new StackPane();
    root.getChildren().add(barChart);
    stage.setScene(new Scene(root, 640, 480));
    stage.show();
}