更改JavaFX图表的填充颜色

时间:2014-12-16 10:30:13

标签: java javafx

我已成功使用JavaFX输出折线图。我想知道如何更改填充颜色(橙色)以使其动态透明(可能不使用CSS)。

这是我现在的代码;

@Override public void start(Stage stage) {
    stage.setTitle("ANN");
    //defining the axes
    final NumberAxis xAxis = new NumberAxis();
    final NumberAxis yAxis = new NumberAxis();
    xAxis.setLabel("Epochs");
    yAxis.setLabel("% of Bad Facts");
    //creating the chart
    final LineChart<Number,Number> lineChart = 
            new LineChart<Number,Number>(xAxis,yAxis);

    lineChart.setTitle("Bad Facts vs Epochs");


    //defining a series
    XYChart.Series series = new XYChart.Series();

    series.setName("BadFacts/Epoch");

    for (int k=0; k<Epochs.length; k++) {
        series.getData().add(new XYChart.Data(Epochs[k], BadFacts[k]));
    }

    Scene scene  = new Scene(lineChart,1500,1100);
    lineChart.getData().add(series);
    stage.setScene(scene);
    stage.show();
}

任何人都可以提示吗?谢谢! enter image description here

0 个答案:

没有答案