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

项目:polTool    文件:GraphView.java   
public GraphView(GraphModel model, Stage primaryStage) {

        Stage stage = new Stage();
        stage.initModality(Modality.NONE);
        stage.initOwner(primaryStage);

        stage.setTitle(model.getStageTitle());
        CategoryAxis xAxis = model.getXAxis();
        NumberAxis yAxis = model.getYAxis();
        StackedBarChart<String, Number> bc = new StackedBarChart<String, Number>(
                xAxis, yAxis);
        bc.setTitle(model.getBarTitle());

        Scene scene = new Scene(bc, 800, 600);
        bc.getData().addAll(model.getSeries());
        stage.setScene(scene);
        stage.show();
    }
项目:Machine-Learning-End-to-Endguide-for-Java-developers    文件:BarCharts - MainApp.java   
public void stackedGraphExample(Stage stage) {
    stage.setTitle("Stacked Bar Chart");
    final StackedBarChart<String, Number> stackedBarChart
            = new StackedBarChart<>(xAxis, yAxis);
    stackedBarChart.setTitle("Country Population");
    xAxis.setLabel("Country");
    xAxis.setCategories(FXCollections.<String>observableArrayList(
            Arrays.asList(belgium, germany, france,
                    netherlands, sweden, unitedKingdom)));
    yAxis.setLabel("Population");

    series1.setName("1950");
    addDataItem(series1, belgium, 8639369);
    addDataItem(series1, france, 42518000);
    addDataItem(series1, germany, 68374572);
    addDataItem(series1, netherlands, 10113527);
    addDataItem(series1, sweden, 7014005);
    addDataItem(series1, unitedKingdom, 50127000);

    series2.setName("1960");
    addDataItem(series2, belgium, 9118700);
    addDataItem(series2, france, 46584000);
    addDataItem(series2, germany, 72480869);
    addDataItem(series2, netherlands, 11486000);
    addDataItem(series2, sweden, 7480395);
    addDataItem(series2, unitedKingdom, 52372000);

    series3.setName("1970");
    addDataItem(series3, belgium, 9637800);
    addDataItem(series3, france, 51918000);
    addDataItem(series3, germany, 77783164);
    addDataItem(series3, netherlands, 13032335);
    addDataItem(series3, sweden, 8042803);
    addDataItem(series3, unitedKingdom, 55632000);

    Scene scene = new Scene(stackedBarChart, 800, 600);
    stackedBarChart.getData().addAll(series1, series2, series3);
    stage.setScene(scene);
    stage.show();
}
项目:Java-Data-Science-Made-Easy    文件:BarCharts - MainApp.java   
public void stackedGraphExample(Stage stage) {
    stage.setTitle("Stacked Bar Chart");
    final StackedBarChart<String, Number> stackedBarChart
            = new StackedBarChart<>(xAxis, yAxis);
    stackedBarChart.setTitle("Country Population");
    xAxis.setLabel("Country");
    xAxis.setCategories(FXCollections.<String>observableArrayList(
            Arrays.asList(belgium, germany, france,
                    netherlands, sweden, unitedKingdom)));
    yAxis.setLabel("Population");

    series1.setName("1950");
    addDataItem(series1, belgium, 8639369);
    addDataItem(series1, france, 42518000);
    addDataItem(series1, germany, 68374572);
    addDataItem(series1, netherlands, 10113527);
    addDataItem(series1, sweden, 7014005);
    addDataItem(series1, unitedKingdom, 50127000);

    series2.setName("1960");
    addDataItem(series2, belgium, 9118700);
    addDataItem(series2, france, 46584000);
    addDataItem(series2, germany, 72480869);
    addDataItem(series2, netherlands, 11486000);
    addDataItem(series2, sweden, 7480395);
    addDataItem(series2, unitedKingdom, 52372000);

    series3.setName("1970");
    addDataItem(series3, belgium, 9637800);
    addDataItem(series3, france, 51918000);
    addDataItem(series3, germany, 77783164);
    addDataItem(series3, netherlands, 13032335);
    addDataItem(series3, sweden, 8042803);
    addDataItem(series3, unitedKingdom, 55632000);

    Scene scene = new Scene(stackedBarChart, 800, 600);
    stackedBarChart.getData().addAll(series1, series2, series3);
    stage.setScene(scene);
    stage.show();
}
项目:Java-for-Data-Science    文件:BarCharts - MainApp.java   
public void stackedGraphExample(Stage stage) {
    stage.setTitle("Stacked Bar Chart");
    final StackedBarChart<String, Number> stackedBarChart
            = new StackedBarChart<>(xAxis, yAxis);
    stackedBarChart.setTitle("Country Population");
    xAxis.setLabel("Country");
    xAxis.setCategories(FXCollections.<String>observableArrayList(
            Arrays.asList(belgium, germany, france,
                    netherlands, sweden, unitedKingdom)));
    yAxis.setLabel("Population");

    series1.setName("1950");
    addDataItem(series1, belgium, 8639369);
    addDataItem(series1, france, 42518000);
    addDataItem(series1, germany, 68374572);
    addDataItem(series1, netherlands, 10113527);
    addDataItem(series1, sweden, 7014005);
    addDataItem(series1, unitedKingdom, 50127000);

    series2.setName("1960");
    addDataItem(series2, belgium, 9118700);
    addDataItem(series2, france, 46584000);
    addDataItem(series2, germany, 72480869);
    addDataItem(series2, netherlands, 11486000);
    addDataItem(series2, sweden, 7480395);
    addDataItem(series2, unitedKingdom, 52372000);

    series3.setName("1970");
    addDataItem(series3, belgium, 9637800);
    addDataItem(series3, france, 51918000);
    addDataItem(series3, germany, 77783164);
    addDataItem(series3, netherlands, 13032335);
    addDataItem(series3, sweden, 8042803);
    addDataItem(series3, unitedKingdom, 55632000);

    Scene scene = new Scene(stackedBarChart, 800, 600);
    stackedBarChart.getData().addAll(series1, series2, series3);
    stage.setScene(scene);
    stage.show();
}
项目:openjfx-8u-dev-tests    文件:StackedBarChartApp.java   
public static Chart createObject(Axis x_axis, Axis y_axis, double width, double height) {

        Series s1 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data("First", 4),
                    new XYChart.Data("Second", 5),
                    new XYChart.Data("Fourth", 6)
                ));
        s1.setName("Set 1");
        Series s2 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data("First", 4),
                    new XYChart.Data("Second", 3),
                    new XYChart.Data("Fourth", 2)
                ));
        s2.setName("Set 2");
        Series s3 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data("First", 4),
                    new XYChart.Data("Second", 6),
                    new XYChart.Data("Fourth", 8)
                ));
        s3.setName("Set 3");
        ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
        StackedBarChart chart = new StackedBarChart(x_axis, y_axis, data);
        chart.setMaxSize(width, height);
        chart.setPrefSize(width, height);
        chart.setTitle("StackedBarChart");
        chart.setStyle("-fx-border-color: darkgray;");
        return chart;
    }
项目:openjfx-8u-dev-tests    文件:StackedBarChartTest.java   
@Override
protected Chart getNewChartInstance() {
    ObservableList<String> existingCategories = FXCollections.observableArrayList();
    existingCategories.addAll("category1", "category2", "category3");
    CategoryAxis axis1 = new CategoryAxis(existingCategories);
    NumberAxis axis2 = new NumberAxis(0, 100, 10);
    StackedBarChart chart = new StackedBarChart(axis2, axis1);
    return chart;
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetStackedBarChartAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(StackedBarChart.class);

    assertThat(adjuster, is(instanceOf(RegionAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Region.class)));
}
项目:AsciidocFX    文件:StackedBarChartBuilderService.java   
@Override
protected XYChart<String, Number> createXYChart() {
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    final XYChart<String, Number> chart = new StackedBarChart<String, Number>(xAxis, yAxis);
    chart.getStyleClass().add("chart-extension");
    return chart;
}
项目:jvarkit    文件:AlleleFrequencyChartFactory.java   
@Override
public Chart build() {          
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("AF");
       final NumberAxis yAxis = new NumberAxis();
       yAxis.setLabel("Count");


    final XYChart.Series<String, Number> serie= new XYChart.Series<String, Number>();
    serie.setName(xAxis.getLabel());


       for(final Limit limit  :this.limits)
        {
        if(this.afindexcount.count(limit.index)==0L) continue;
        serie.getData().add(new XYChart.Data<String,Number>(
                limit.label,
                this.afindexcount.count(limit.index))
                );
        }

       final StackedBarChart<String, Number> sbc =
               new StackedBarChart<String, Number>(xAxis, yAxis);
       sbc.setTitle("Allele Frequency"+(this.nSamples>0?" (Nbr. Sample(s):"+this.nSamples+")":""));
       sbc.getData().add(serie);
       sbc.setCategoryGap(0.2);
       sbc.setLegendVisible(false);
       return sbc;
       }
项目:jvarkit    文件:TiTvChartFactory.java   
@Override
public Chart build() {          
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("Sample");
       final NumberAxis yAxis = new NumberAxis();
       yAxis.setLabel("Count");

       final List<XYChart.Series<String, Number>> type2count =new ArrayList<>(3);
       for(int i=0;i<2;++i) {
        final XYChart.Series<String, Number> serie= new XYChart.Series<String, Number>();
        serie.setName(i==0?"Transition":"Transversion");
        type2count.add(serie);

        if( this.sample2titv.isEmpty())
            {
            serie.getData().add(new XYChart.Data<String,Number>(
                    "ALL",
                    (i==0?all.transition:all.transvertion)
                    ));
            }
        else
            {
            for(final String sampleName : this.sample2titv.keySet())
                {
                final TiTv titv= this.sample2titv.get(sampleName);
                serie.getData().add(new XYChart.Data<String,Number>(
                        sampleName,
                        (i==0?titv.transition:titv.transvertion)
                        ));
                }
            }
        }
       final StackedBarChart<String, Number> sbc =
               new StackedBarChart<String, Number>(xAxis, yAxis);
       sbc.setTitle(this.getName());
       sbc.getData().addAll(type2count);
       sbc.setCategoryGap(0.2);
       return sbc;
       }
项目:jvarkit    文件:GenotypeTypeChartFactory.java   
@Override
public Chart build() {          
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("Sample");
       final NumberAxis yAxis = new NumberAxis();
       yAxis.setLabel("Count");

       final List<XYChart.Series<String, Number>> gtype2count=new ArrayList<>(GenotypeType.values().length);
       for(final GenotypeType genotypeType :GenotypeType.values()) {
        final XYChart.Series<String, Number> serie= new XYChart.Series<String, Number>();
        serie.setName(genotypeType.name());
        gtype2count.add(serie);

        for(final String sampleName : this.sample2count.keySet())
            {
            serie.getData().add(new XYChart.Data<String,Number>(
                    sampleName,
                    this.sample2count.get(sampleName).count(genotypeType))
                    );
            }
        }

       final StackedBarChart<String, Number> sbc =
               new StackedBarChart<String, Number>(xAxis, yAxis);
       sbc.setTitle(this.getName());
       sbc.getData().addAll(gtype2count);
       sbc.setCategoryGap(0.2);
       return sbc;
       }
项目:jvarkit    文件:SamFlagsChartFactory.java   
@Override
public StackedBarChart<String, Number> build()
    {           
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("Flags");
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setLabel("Count");


    final XYChart.Series<String, Number> serie= new XYChart.Series<String, Number>();
    serie.setName("Flags");


    for(final Integer L  : new TreeSet<Integer>(this.flags2count.keySet()))
        {
        serie.getData().add(new XYChart.Data<String,Number>(
                String.valueOf(L),
                this.flags2count.count(L))
                );
        }

    final StackedBarChart<String, Number> sbc =
            new StackedBarChart<String, Number>(xAxis, yAxis);
    sbc.setTitle("SAM Flags");
    sbc.getData().add(serie);
    sbc.setCategoryGap(0.2);
    sbc.setLegendVisible(false);
    return sbc;
    }
项目:jvarkit    文件:ReadLengthChartFactory.java   
@Override
public StackedBarChart<String, Number> build()
    {           
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("Length");
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setLabel("Count");


    final XYChart.Series<String, Number> serie= new XYChart.Series<String, Number>();
    serie.setName("Length");


    for(final Integer L  : new TreeSet<Integer>(this.length2count.keySet()))
        {
        serie.getData().add(new XYChart.Data<String,Number>(
                String.valueOf(L),
                this.length2count.count(L))
                );
        }

    final StackedBarChart<String, Number> sbc =
            new StackedBarChart<String, Number>(xAxis, yAxis);
    sbc.setTitle("Reads Lengths");
    sbc.getData().add(serie);
    sbc.setCategoryGap(0.2);
    sbc.setLegendVisible(false);
    return sbc;
    }
项目:jvarkit    文件:CigarOpPerPositionChartFactory.java   
@Override
public StackedBarChart<String, Number> build()
    {        
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("Position in Read");
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setLabel("Count");


    final List<XYChart.Series<String, Number>> base2count=new ArrayList<>();
    for(final CigarOperator cigarop:CigarOperator.values())
        {
        if(cigarop==CigarOperator.P) continue;
        final XYChart.Series<String, Number> serie= new XYChart.Series<String, Number>();
        serie.setName(cigarop.name());
        base2count.add(serie);

     for(int i=0;i<  this.cigar2pos2count.size();++i)
        {
        serie.getData().add(new XYChart.Data<String,Number>(
                String.valueOf(i+1),
                this.cigar2pos2count.get(i).count(cigarop))
                );
        }
     }

    final StackedBarChart<String, Number> sbc =
            new StackedBarChart<String, Number>(xAxis, yAxis);
    sbc.setTitle(getName());
    sbc.getData().addAll(base2count);
    sbc.setCategoryGap(0.2);

    return sbc;
    }
项目:jvarkit    文件:BasesPerPositionChartFactory.java   
@Override
public StackedBarChart<String, Number> build()
    {        
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("Position in Read");
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setLabel("Count");


    final List<XYChart.Series<String, Number>> base2count=new ArrayList<>(all_chars.size());
    for(final Character base:all_chars) {
        final XYChart.Series<String, Number> serie= new XYChart.Series<String, Number>();
        serie.setName(base.toString());
        base2count.add(serie);

     for(int i=0;i<  this.pos2base2count.size();++i)
        {
        serie.getData().add(new XYChart.Data<String,Number>(
                String.valueOf(i+1),
                this.pos2base2count.get(i).count(base))
                );
        }
     }

    final StackedBarChart<String, Number> sbc =
            new StackedBarChart<String, Number>(xAxis, yAxis);
    sbc.setTitle("Position/Base/Count");
    sbc.getData().addAll(base2count);
    sbc.setCategoryGap(0.2);

    return sbc;
    }
项目:openjfx-8u-dev-tests    文件:NewStackedBarChartApp.java   
public StackedBarChart getNewChart() {
    StackedBarChart chart = new StackedBarChart(axis1, axis2);
    chart.setTitle("StackedBarChart");
    chart.setStyle("-fx-border-color: darkgray;");
    return chart;
}