2016-06-01 9 views
0

Ich bin neu in JavaFX/RCP und versuchen, ein Beispiel JavaFX-Diagramm in RCP-Anwendung auszuführen. Es zeigt einen leeren Dialog ohne Grafik an. Kann mir jemand helfen, das Problem zu identifizieren?JavaFX AreaChat Grafik in RCP-Anwendung

@Execute 
    public void execute(final Shell shell) { 

    if (shlInfrastructureReport != null && !shlInfrastructureReport.isDisposed()){ 

     shlInfrastructureReport.close(); 
    } 

    shlInfrastructureReport = new Shell(shell.getDisplay()); 
    final FXCanvas fxCanvas = new FXCanvas(shlInfrastructureReport, SWT.NONE); 
    Group group = new Group(); 
    Scene scene = new Scene(group); 

    final NumberAxis xAxis = new NumberAxis(1, 31, 1); 
    final NumberAxis yAxis = new NumberAxis(); 
    final AreaChart<Number,Number> areaChat = new AreaChart<Number,Number>(xAxis,yAxis); 
    areaChat.setTitle("Sample Report"); 

    XYChart.Series series= new XYChart.Series(); 
    series.setName("Sample"); 
    series.getData().add(new XYChart.Data(1, 4)); 
    series.getData().add(new XYChart.Data(3, 10)); 
    series.getData().add(new XYChart.Data(6, 15)); 
    series.getData().add(new XYChart.Data(9, 8)); 
    series.getData().add(new XYChart.Data(12, 5)); 
    series.getData().add(new XYChart.Data(15, 18)); 
    series.getData().add(new XYChart.Data(18, 15)); 
    series.getData().add(new XYChart.Data(21, 13)); 
    series.getData().add(new XYChart.Data(24, 19)); 
    series.getData().add(new XYChart.Data(27, 21)); 
    series.getData().add(new XYChart.Data(30, 21)); 

    areaChat.getData().addAll(series); 
    group.getChildren().add(areaChat); 
    fxCanvas.setScene(scene); 

Antwort

0

Danke, es hat Auflösung. Problem ist, dass ich das Layout verpasst habe.

final RowLayout layout = new RowLayout(); 
    shlInfrastructureReport.setLayout(layout);