我想指定LowerBound变量(0> x),但AreaChart变得奇怪。 请告诉我这个解决方案。
抱歉..我没有声望点。 如果我有上传信誉点那么做。JavaFX版本2.2.51-b13
谢谢
这是代码:
public class chartApp extends Application{
@Override
public void start(Stage stage){
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
final AreaChart<Number, Number> areaChart = new AreaChart<Number, Number>(xAxis,yAxis);
XYChart.Series series = new XYChart.Series();
final Integer[] yData = {500,501,502,503,500,502,499,498};
yAxis.setAutoRanging(false);
yAxis.setUpperBound(520.d);
yAxis.setLowerBound(480.d);
for (int i = 0; i < yData.length; i++) {
series.getData().add(new XYChart.Data(i, yData[i]));
}
Scene scene = new Scene(areaChart, 800, 600);
areaChart.getData().add(series);
stage.setScene(scene);
stage.show();
System.out.println(com.sun.javafx.runtime.VersionInfo.getRuntimeVersion());
}
public static void main(String[] args){
launch(args);
}
}