Example usage for javafx.scene.chart BarChart BarChart

List of usage examples for javafx.scene.chart BarChart BarChart

Introduction

In this page you can find the example usage for javafx.scene.chart BarChart BarChart.

Prototype

public BarChart(@NamedArg("xAxis") Axis<X> xAxis, @NamedArg("yAxis") Axis<Y> yAxis,
        @NamedArg("data") ObservableList<Series<X, Y>> data, @NamedArg("categoryGap") double categoryGap) 

Source Link

Document

Construct a new BarChart with the given axis and data.

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    BarChart barChart = new BarChart(xAxis, yAxis, getChartData(), 0.2);
    barChart.setTitle("A");
    primaryStage.setTitle("BarChart example");

    StackPane root = new StackPane();
    root.getChildren().add(barChart);/*  ww  w.  j a v a  2s  . co m*/
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}