Java 类javafx.scene.chart.StackedAreaChart 实例源码

项目:pcstatus    文件:StackedAreaChartClass.java   
/**
 * the constructor is responsible for initialize the chart (lower and upper buonds, name, colors)
 * @param stackedAreaChart is the type of chart for battery performance
 */
public StackedAreaChartClass(StackedAreaChart stackedAreaChart){
    NumberAxis yaxis = (NumberAxis) stackedAreaChart.getYAxis();

    //getter and setting proprieties for y and x axes
    xAxis = (NumberAxis) stackedAreaChart.getXAxis();
    xAxis.setLowerBound(0);
    xAxis.setUpperBound(10);
    xAxis.setAutoRanging(false);
    xAxis.setTickLabelsVisible(false); //hide numbers on x axis
    stackedAreaChart.setVerticalGridLinesVisible(false);//hide vertical lines
    stackedAreaChart.animatedProperty().setValue(false);
    yaxis.setAutoRanging(false);
    yaxis.setLowerBound(0);
    yaxis.setUpperBound(100);

    //set series of content to draw chart
    series = new XYChart.Series();
    series.setName("Battery level");
    stackedAreaChart.getData().add(series);

    //setting colors of charts
    Node fill = series.getNode().lookup(".chart-series-area-fill");
    fill.setStyle("-fx-fill: #fff7ad;");
    Node line = series.getNode().lookup(".chart-series-area-line");
    line.setStyle("-fx-stroke: #8bc34a;" +
            "-fx-stroke-width: 3px;"); // set width of line
    stackedAreaChart.setStyle("CHART_COLOR_1: #8bc34a;"); //color of dots
}
项目:openjfx-8u-dev-tests    文件:StackedAreaChartTest.java   
@Override
protected Chart getNewChartInstance() {
    NumberAxis axis1 = new NumberAxis(0, 100, 10);
    NumberAxis axis2 = new NumberAxis(0, 100, 10);
    StackedAreaChart chart = new StackedAreaChart(axis1, axis2);
    return chart;
}
项目:openjfx-8u-dev-tests    文件:AreaStackedAreaChartsCommon.java   
@Test(timeout = 60000)
public void createSymbolsPropertyTest() {
    assertTrue(new AreaChart(new NumberAxis(), new NumberAxis()).getCreateSymbols());
    assertTrue(new StackedAreaChart(new NumberAxis(), new NumberAxis()).getCreateSymbols());
    populateChart();

    checkTextFieldText(AreaTestsProperties.createSymbols, "true");
    checkDotsCount(30);

    setPropertyByToggleClick(SettingType.BIDIRECTIONAL, AreaTestsProperties.createSymbols, false);
    checkTextFieldText(AreaTestsProperties.createSymbols, "false");
    checkDotsCount(0);

    setPropertyByToggleClick(SettingType.SETTER, AreaTestsProperties.createSymbols, true);
    checkTextFieldText(AreaTestsProperties.createSymbols, "true");
    checkDotsCount(30);

    setPropertyByToggleClick(SettingType.UNIDIRECTIONAL, AreaTestsProperties.createSymbols, false);
    checkTextFieldText(AreaTestsProperties.createSymbols, "false");
    checkDotsCount(0);

    removeFromIndex(2, 1, 0);
    checkDotsCount(0);

    setPropertyByToggleClick(SettingType.UNIDIRECTIONAL, AreaTestsProperties.createSymbols, true);

    addSeries("Series C", 0, 100, 30);
    checkDotsCount(30);

    removeFromIndex(0);
    checkDotsCount(0);

    setPropertyByToggleClick(SettingType.UNIDIRECTIONAL, AreaTestsProperties.createSymbols, false);

    checkDotsCount(0);
    addSeries("Series C", 0, 100, 30);

    checkDotsCount(0);
}
项目:binjr    文件:StackedAreaChartWorksheetController.java   
@Override
protected XYChart<ZonedDateTime, Double> buildChart(ZonedDateTimeAxis xAxis, ValueAxis<Double> yAxis, BooleanProperty showSymbolsProperty) {
    StackedAreaChart<ZonedDateTime, Double> newChart = new StackedAreaChart<>(xAxis, yAxis);
    newChart.setCreateSymbols(false);
    newChart.createSymbolsProperty().bindBidirectional(showSymbolsProperty);
    return newChart;
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetStackedAreaChartAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(StackedAreaChart.class);

    assertThat(adjuster, is(instanceOf(RegionAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Region.class)));
}
项目:AsciidocFX    文件:StackedAreaChartBuilderService.java   
@Override
protected XYChart<String, Number> createXYChart() {
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    final XYChart<String, Number> chart = new StackedAreaChart<String, Number>(xAxis, yAxis);
    chart.getStyleClass().add("chart-extension");
    return chart;
}
项目:marathonv5    文件:StackedAreaChartSample.java   
public StackedAreaChartSample() {
    NumberAxis xAxis = NumberAxisBuilder.create()
                       .label("X Values")
                       .lowerBound(1.0d)
                       .upperBound(9.0d)
                       .tickUnit(2.0d).build();

    NumberAxis yAxis = NumberAxisBuilder.create()
                       .label("Y Values")
                       .lowerBound(0.0d)
                       .upperBound(30.0d)
                       .tickUnit(2.0d).build();

    ObservableList<StackedAreaChart.Series> areaChartData = FXCollections.observableArrayList(
            new StackedAreaChart.Series("Series 1",FXCollections.observableArrayList(
                new StackedAreaChart.Data(0,4),
                new StackedAreaChart.Data(2,5),
                new StackedAreaChart.Data(4,4),
                new StackedAreaChart.Data(6,2),
                new StackedAreaChart.Data(8,6),
                new StackedAreaChart.Data(10,8)
            )),
            new StackedAreaChart.Series("Series 2", FXCollections.observableArrayList(
                new StackedAreaChart.Data(0,8),
                new StackedAreaChart.Data(2,2),
                new StackedAreaChart.Data(4,9),
                new StackedAreaChart.Data(6,7),
                new StackedAreaChart.Data(8,5),
                new StackedAreaChart.Data(10,7)
            )),
            new StackedAreaChart.Series("Series 3", FXCollections.observableArrayList(
                new StackedAreaChart.Data(0,2),
                new StackedAreaChart.Data(2,5),
                new StackedAreaChart.Data(4,8),
                new StackedAreaChart.Data(6,6),
                new StackedAreaChart.Data(8,9),
                new StackedAreaChart.Data(10,7)
            ))
    );
    StackedAreaChart chart = new StackedAreaChart(xAxis, yAxis, areaChartData);
    getChildren().add(chart);
}
项目:marathonv5    文件:StackedAreaChartSample.java   
public StackedAreaChartSample() {
    NumberAxis xAxis = NumberAxisBuilder.create()
                       .label("X Values")
                       .lowerBound(1.0d)
                       .upperBound(9.0d)
                       .tickUnit(2.0d).build();

    NumberAxis yAxis = NumberAxisBuilder.create()
                       .label("Y Values")
                       .lowerBound(0.0d)
                       .upperBound(30.0d)
                       .tickUnit(2.0d).build();

    ObservableList<StackedAreaChart.Series> areaChartData = FXCollections.observableArrayList(
            new StackedAreaChart.Series("Series 1",FXCollections.observableArrayList(
                new StackedAreaChart.Data(0,4),
                new StackedAreaChart.Data(2,5),
                new StackedAreaChart.Data(4,4),
                new StackedAreaChart.Data(6,2),
                new StackedAreaChart.Data(8,6),
                new StackedAreaChart.Data(10,8)
            )),
            new StackedAreaChart.Series("Series 2", FXCollections.observableArrayList(
                new StackedAreaChart.Data(0,8),
                new StackedAreaChart.Data(2,2),
                new StackedAreaChart.Data(4,9),
                new StackedAreaChart.Data(6,7),
                new StackedAreaChart.Data(8,5),
                new StackedAreaChart.Data(10,7)
            )),
            new StackedAreaChart.Series("Series 3", FXCollections.observableArrayList(
                new StackedAreaChart.Data(0,2),
                new StackedAreaChart.Data(2,5),
                new StackedAreaChart.Data(4,8),
                new StackedAreaChart.Data(6,6),
                new StackedAreaChart.Data(8,9),
                new StackedAreaChart.Data(10,7)
            ))
    );
    StackedAreaChart chart = new StackedAreaChart(xAxis, yAxis, areaChartData);
    getChildren().add(chart);
}
项目:openjfx-8u-dev-tests    文件:StackedAreaChartApp.java   
protected Chart createObject(Axis x_axis, Axis y_axis, double width, double height) {

        Series s1 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(1,2),
                    new XYChart.Data(2,3),
                    new XYChart.Data(3,5),
                    new XYChart.Data(4,1),
                    new XYChart.Data(6,4),
                    new XYChart.Data(7,2),
                    new XYChart.Data(8,3),
                    new XYChart.Data(9,4)
                ));
        s1.setName("Set 1");
        Series s2 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(1,1),
                    new XYChart.Data(2,4),
                    new XYChart.Data(3,2),
                    new XYChart.Data(6,5),
                    new XYChart.Data(7,3),
                    new XYChart.Data(8,2),
                    new XYChart.Data(9,1)
                ));
        s2.setName("Set 2");
        Series s3 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(1,5),
                    new XYChart.Data(2,3),
                    new XYChart.Data(3,1),
                    new XYChart.Data(4,2),
                    new XYChart.Data(6,3),
                    new XYChart.Data(7,1),
                    new XYChart.Data(8,4)
                ));
        s3.setName("Set 3");
        ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
        StackedAreaChart chart = new StackedAreaChart(x_axis, y_axis, data);
        chart.setMaxSize(width, height);
        chart.setPrefSize(width, height);
        chart.setTitle("StackedAreaChart");
        chart.setStyle("-fx-border-color: darkgray;");
        return chart;
    }
项目:openjfx-8u-dev-tests    文件:NewStackedAreaChartApp.java   
public StackedAreaChart getNewChart() {
    StackedAreaChart chart = new StackedAreaChart(axis1, axis2);
    chart.setTitle("StackedAreaChart");
    chart.setStyle("-fx-border-color: darkgray;");
    return chart;
}
项目:kotlinfx-ensemble    文件:StackedAreaChartSample.java   
public StackedAreaChartSample() {
    NumberAxis xAxis = NumberAxisBuilder.create()
                       .label("X Values")
                       .lowerBound(1.0d)
                       .upperBound(9.0d)
                       .tickUnit(2.0d).build();

    NumberAxis yAxis = NumberAxisBuilder.create()
                       .label("Y Values")
                       .lowerBound(0.0d)
                       .upperBound(30.0d)
                       .tickUnit(2.0d).build();

    ObservableList<StackedAreaChart.Series> areaChartData = FXCollections.observableArrayList(
            new StackedAreaChart.Series("Series 1",FXCollections.observableArrayList(
                new StackedAreaChart.Data(0,4),
                new StackedAreaChart.Data(2,5),
                new StackedAreaChart.Data(4,4),
                new StackedAreaChart.Data(6,2),
                new StackedAreaChart.Data(8,6),
                new StackedAreaChart.Data(10,8)
            )),
            new StackedAreaChart.Series("Series 2", FXCollections.observableArrayList(
                new StackedAreaChart.Data(0,8),
                new StackedAreaChart.Data(2,2),
                new StackedAreaChart.Data(4,9),
                new StackedAreaChart.Data(6,7),
                new StackedAreaChart.Data(8,5),
                new StackedAreaChart.Data(10,7)
            )),
            new StackedAreaChart.Series("Series 3", FXCollections.observableArrayList(
                new StackedAreaChart.Data(0,2),
                new StackedAreaChart.Data(2,5),
                new StackedAreaChart.Data(4,8),
                new StackedAreaChart.Data(6,6),
                new StackedAreaChart.Data(8,9),
                new StackedAreaChart.Data(10,7)
            ))
    );
    StackedAreaChart chart = new StackedAreaChart(xAxis, yAxis, areaChartData);
    getChildren().add(chart);
}