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

项目:Recordian    文件:GraphsTabController.java   
/**
 * Generates a PDF report containing images of
 * the charts currently displayed to the user
 *
 * @param charts the charts that are to be exported as images to a PDF
 */
private void generateReport(List<Chart> charts) {

    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Save Copy of Graphs");
    fileChooser.setInitialDirectory(
            new File(System.getProperty("user.home"))
    );
    fileChooser.setInitialFileName("Log Entry Graphs.pdf");
    FileChooser.ExtensionFilter pdfExtensionFilter =
            new FileChooser.ExtensionFilter(
                    "PDF - Portable Document Format (.pdf)", "*.pdf");
    fileChooser.getExtensionFilters().add(pdfExtensionFilter);
    fileChooser.setSelectedExtensionFilter(pdfExtensionFilter);
    File file = fileChooser.showSaveDialog(currentStage);

    if (file != null) {
        try {
            exportChartsIntoPDF(file, charts);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
项目:Recordian    文件:GraphsTabController.java   
/**
 * Converts charts to Java {@link WritableImage}s
 *
 * @param charts the charts to be converted to {@link WritableImage}s
 * @return a {@link List} of {@link WritableImage}s
 */
private List<WritableImage> chartsToImages(List<Chart> charts) {
    List<WritableImage> chartImages = new ArrayList<>();

    // Scaling the chart image gives it a higher resolution
    // which results in a better image quality when the
    // image is exported to the pdf
    SnapshotParameters snapshotParameters = new SnapshotParameters();
    snapshotParameters.setTransform(new Scale(2, 2));

    for (Chart chart : charts) {
        chartImages.add(chart.snapshot(snapshotParameters, null));
    }

    return  chartImages;
}
项目:openjfx-8u-dev-tests    文件:ChartTestsBase.java   
protected void checkLegendContentSizeCorrectness() {
    int itemsSize = new GetAction<Integer>() {
        @Override
        public void run(Object... os) throws Exception {
            final Chart chart = testedControl.getControl();
            if (chart instanceof PieChart) {
                setResult(((PieChart) chart).getData().size());
            } else {
                setResult(((XYChart) chart).getData().size());
            }
        }
    }.dispatch(Root.ROOT.getEnvironment());

    final List<Wrap<? extends Label>> legendLabels = chartDescriptionProvider.getLegendLabels();
    Assert.assertEquals(legendLabels.size(), itemsSize);
}
项目:qupath    文件:ChartToolsFX.java   
/**
 * Charts tend to show their legends with circular/square markers... which isn't much use 
 * when line strokes distinguish between different Series.
 * 
 * This method addresses this by setting the graphics for legend labels to be lines with the appropriate strokes.
 * 
 * @param chart
 * @param length
 */
public static void setLineChartLegendLines(final Chart chart, final double length) {
    Region legend = (Region)chart.lookup(".chart-legend");
    int count = 0;
    for (Node legendItem : legend.getChildrenUnmodifiable()) {
        if (legendItem instanceof Label) {
            Label label = (Label)legendItem;
            Line line = new Line(0, 4, 25, 4);
            if (chart instanceof XYChart<?, ?>) {
                XYChart<?, ?> xyChart = (XYChart<?, ?>)chart;
                if (xyChart.getData().get(count).getData().isEmpty()) {
                    label.setGraphic(null);
                    count++;
                    continue;
                }
            }
            line.getStyleClass().setAll("chart-series-line", "default-color"+count);
            label.setGraphic(line);
            count++;
        }
    }
}
项目:qupath    文件:ChartToolsFX.java   
/**
 * Expand the clip region for a chart.
 * 
 * This helps to avoid clipping off markers at the chart boundaries.
 * 
 * @param chart
 * @param pad The amount by which to expand the clip rectangle in each direction; if < 0, the clip will be completely removed
 */
public static void expandChartClip(final Chart chart, final double pad) {
    Rectangle newClip;
    Region chartContent = (Region)chart.lookup(".chart-content");
    for (Node node: chartContent.getChildrenUnmodifiable()) {
        if (node instanceof Group) {
            Group plotArea = (Group)node;
            if (pad < 0)
                plotArea.setClip(null);
            else if (plotArea.getClip() instanceof Rectangle) {
                Rectangle previousClip = (Rectangle)plotArea.getClip();
                newClip = new Rectangle();
                newClip.xProperty().bind(previousClip.xProperty().subtract(pad));
                newClip.yProperty().bind(previousClip.yProperty().subtract(pad));
                newClip.widthProperty().bind(previousClip.widthProperty().add(pad*2));
                newClip.heightProperty().bind(previousClip.heightProperty().add(pad*2));
                plotArea.setClip(newClip);
            }
        }
    }
}
项目:CloudTrailViewer    文件:ChartHoverUtil.java   
public static void setupPieChartHovering(Chart chart) {

        if (chart instanceof PieChart) {
            new ChartHoverUtil<PieChart.Data>(
                    data -> String.format("Value = %s", data.getPieValue()),
                    PieChart.Data::getNode)
                    .setupHovering(((PieChart)chart).getData());
        }

        if (chart instanceof XYChart) {
            new ChartHoverUtil<XYChart.Series<String, Number>>(
                    data -> String.format("Value = %s", data.getData().get(0).getYValue()),
                    data -> data.getNode())
                    .setupHovering(((XYChart)chart).getData());
        }

    }
项目:jvarkit    文件:VariantQualChartFactory.java   
@Override
public Chart build() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setLabel("QUAL");
       final NumberAxis yAxis = new NumberAxis();
       yAxis.setLabel("Count");

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

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


       final LineChart<Number, Number> sbc =
               new LineChart<Number, Number>(xAxis, yAxis);
       sbc.setTitle(this.getName());
       sbc.getData().add(serie);
       sbc.setCreateSymbols(false);
       sbc.setLegendVisible(false);
       return sbc;
       }
项目:jvarkit    文件:NgsStage.java   
/** show stats for whole file */
  protected final <T> void doMenuShowLocalStats(final ChartFactory<HEADERTYPE,T> factory,final Supplier<List<T>> data)
    {
    LOG.info("creating chart "+factory.getName());
    factory.setHeader(getNgsFile().getHeader());
    factory.setPedigree(getPedigree());
    final List<T> L=data.get();
    LOG.info("creating n items "+L.size());

    for(final T o:L) factory.visit(o);
final Chart chart=factory.build();
    final BorderPane contentPane=new BorderPane(chart);
    contentPane.setPadding(new Insets(10));
    final Stage dialog = new Stage();
    dialog.initOwner(this);
    dialog.setTitle(factory.getName());
    contentPane.setTop(new Label("Data for "+this.ngsFile.getSource()));
        dialog.setScene(new Scene(contentPane));
    contentPane.setBottom(new Label("Number of items: "+L.size()));
    LOG.info("Showing chart");
    dialog.show();
    }
项目:dragdropfx    文件:DragDropFX.java   
@Override
public Void call(Object p) {
    if(isIgnored(p)){return null;}
    Chart c = (Chart) p;
    DnDPrepare.gfx(c);
    return null;
}
项目:ulviewer    文件:ChartViewer.java   
protected Stage createStage(Chart chart, String title){
    Stage window = new Stage(StageStyle.UTILITY);
    window.setScene(new Scene(chart, 800, 450));
    window.initModality(Modality.NONE);
    window.setTitle(title);

    return window;
}
项目:openjfx-8u-dev-tests    文件:AreaChartApp.java   
protected Chart createObject(Axis x_axis, Axis y_axis, double width, double height) {

        Series s1 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(1,4),
                    new XYChart.Data(2,5),
                    new XYChart.Data(3,6)
                ));
        s1.setName("Set 1");
        Series s2 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(4,4),
                    new XYChart.Data(5,3),
                    new XYChart.Data(6,2)
                ));
        s2.setName("Set 2");
        Series s3 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(7,4),
                    new XYChart.Data(8,6),
                    new XYChart.Data(9,8)
                ));
        s3.setName("Set 3");
        ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
        AreaChart chart = new AreaChart(x_axis, y_axis, data);
        chart.setMaxSize(width, height);
        chart.setPrefSize(width, height);
        chart.setTitle("AreaChart");
        chart.setStyle("-fx-border-color: darkgray;");
        return chart;
    }
项目:openjfx-8u-dev-tests    文件:NumberAxisApp.java   
private void setupUpperBoundOverflow(String name, double d) {
    pageSetup(Pages.UpperBoundOverflow.name(), new TestNode(name) {
        @Override
        public Node drawNode() {
            NumberAxis y = new NumberAxis();
            NumberAxis x = new NumberAxis();
            y.setUpperBound(d);
            x.setUpperBound(5);
            Chart chart = new ScatterChart(x, y);
            chart.maxWidthProperty().set(300);
            chart.maxHeightProperty().set(200);
            return chart;
        }
    });
}
项目: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    文件:CategoryAxisApp.java   
@Override
protected Node createWrap(Axis x_axis, Axis y_axis, double width, double height) {
    Series s1 = new Series( FXCollections.observableArrayList(
                new XYChart.Data("First", "First"),
                new XYChart.Data("Second", "Second"),
                new XYChart.Data("Fourth", "Third")
            ));
    s1.setName("Set 1");
    Series s2 = new Series( FXCollections.observableArrayList(
                new XYChart.Data("First", "Third"),
                new XYChart.Data("Second", "First"),
                new XYChart.Data("Fourth", "Second")
            ));
    s2.setName("Set 2");
    Series s3 = new Series( FXCollections.observableArrayList(
                new XYChart.Data("First", "Second"),
                new XYChart.Data("Second", "Third"),
                new XYChart.Data("Third", "First")
            ));
    s3.setName("Set 3");
    ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
    Chart chart =  new ScatterChart(x_axis, y_axis, data);
    chart.setMaxSize(width, height);
    chart.setPrefSize(width, height);
    chart.setTitle("ScatterChart");
    chart.setStyle("-fx-border-color: darkgray;");
    return chart;
}
项目:openjfx-8u-dev-tests    文件:BarChartApp.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);
        BarChart chart = new BarChart(x_axis, y_axis, data);
        chart.setMaxSize(width, height);
        chart.setPrefSize(width, height);
        chart.setTitle("BarChart");
        chart.setStyle("-fx-border-color: darkgray;");
        return chart;
    }
项目:openjfx-8u-dev-tests    文件:BubbleChartApp.java   
protected Chart createObject(Axis x_axis, Axis y_axis, double width, double height) {

        Series s1 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(3, 4, 0.5),
                    new XYChart.Data(1, 5, 0.2),
                    new XYChart.Data(4, 6, 2)
                ));
        s1.setName("Set 1");
        Series s2 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(1, 4, 0.3),
                    new XYChart.Data(2, 3, 0.2),
                    new XYChart.Data(4, 2, 0.4)
                ));
        s2.setName("Set 2");
        Series s3 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(5, 4, 0.2),
                    new XYChart.Data(1, 6, 1.2),
                    new XYChart.Data(3, 8, 1.1)
                ));
        s3.setName("Set 3");
        ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
        BubbleChart chart = new BubbleChart(x_axis, y_axis, data);
        chart.setMaxSize(width, height);
        chart.setPrefSize(width, height);
        chart.setTitle("BubbleChart");
        chart.setStyle("-fx-border-color: darkgray;");
        return chart;
    }
项目:openjfx-8u-dev-tests    文件:AreaChartTest.java   
@Override
protected Chart getNewChartInstance() {
    NumberAxis axis1 = new NumberAxis(0, 100, 10);
    NumberAxis axis2 = new NumberAxis(0, 100, 10);
    AreaChart chart = new AreaChart(axis1, axis2);
    return chart;
}
项目: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    文件:NumberScatterChartTest.java   
@Override
protected Chart getNewChartInstance() {
    NumberAxis axis1 = new NumberAxis(0, 100, 10);
    NumberAxis axis2 = new NumberAxis(0, 100, 10);
    ScatterChart chart = new ScatterChart(axis1, axis2);
    return chart;
}
项目:openjfx-8u-dev-tests    文件:BarChartTest.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);
    BarChart chart = new BarChart(axis2, axis1);
    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;
}
项目:openjfx-8u-dev-tests    文件:LineChartTest.java   
@Override
protected Chart getNewChartInstance() {
    NumberAxis axis1 = new NumberAxis(0, 100, 10);
    NumberAxis axis2 = new NumberAxis(0, 100, 10);
    LineChart chart = new LineChart(axis1, axis2);
    return chart;
}
项目:openjfx-8u-dev-tests    文件:PieChartTestBase.java   
@Override
protected Chart getNewChartInstance() {
    return new GetAction<Chart>() {
        @Override
        public void run(Object... os) throws Exception {
            //All JavaFX objects must be instantiated on JFX thread.
            setResult(new PieChart());
        }
    }.dispatch(Root.ROOT.getEnvironment());
}
项目:openjfx-8u-dev-tests    文件:BubbleChartTest.java   
@Override
protected Chart getNewChartInstance() {
    NumberAxis axis1 = new NumberAxis(0, 100, 10);
    NumberAxis axis2 = new NumberAxis(0, 100, 10);
    BubbleChart chart = new BubbleChart(axis1, axis2);
    return chart;
}
项目:openjfx-8u-dev-tests    文件:LegendSideAlignmentCssStyle.java   
@Override
public void decorate(Node control, Pane container) {
    super.decorate(control, container);
    if (side == Side.LEFT || side == Side.RIGHT) {
        ((Chart) control).setMinWidth(250); // set minimal size for control, because lenegd dosn't fit
    }
}
项目:PcapAnalyzer    文件:MainFormController.java   
/**
 * 显示图表,所有图表都调往该方法显示,可以确保当前只有一个图标对用户可见
 * @param chart
 */
private void showChart(Chart chart) {
    if (chart == null) return;

    if (curVisibleChart == null || curVisibleChart != chart) {
        if (curVisibleChart != null) {
            curVisibleChart.setVisible(false);
        }
        chart.setVisible(true);
        curVisibleChart = chart;
    }
}
项目:qupath    文件:ExportChartPanel.java   
/**
 * Create and display an export chart panel.
 * 
 * @param chart The chart to display.
 * @param duplicator A duplicator (optional) to create a duplicate chart, rather than using the original.
 * @return
 */
public static ExportChartPanel showExportChartPanel(final Chart chart, final Callback<Chart, Chart> duplicator) {
    ExportChartPanel panel = new ExportChartPanel(duplicator == null ? chart : duplicator.call(chart));
    Scene scene = new Scene(panel.getPane());
    Stage stage = new Stage();
    stage.setTitle("Export chart");
    stage.setScene(scene);
    stage.show();
    panel.refreshChartDisplay();
    return panel;
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetChartAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(Chart.class);

    assertThat(adjuster, is(instanceOf(RegionAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Region.class)));
}
项目:Corendon    文件:ManagerStatisticsPDF.java   
public static void generateManagerReportPDF(File file, Chart chart){
    try {
        Document document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream(file));
        document.open();
        addContent(file, document, chart);
        document.close();
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
项目:jvarkit    文件:AFBySexChartFactory.java   
@Override
public Chart build() {          
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("Sex");
       final NumberAxis yAxis = new NumberAxis();
       yAxis.setLabel("Mean-MAF");

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

       for(int i=0;i< this.popcount.size();++i) {
        final PedFile.Sex sexxxxx = PedFile.Sex.values()[i];
        double v=0;
        if(this.popcount.get(i).num_maf>0)
            {
            v=this.popcount.get(i).sum/((double)this.popcount.get(i).num_maf);
            }
        serie.getData().add(new XYChart.Data<String,Number>(
                sexxxxx.name(),v)
                );

        }

       final BarChart<String, Number> sbc =
               new BarChart<String, Number>(xAxis, yAxis);
       sbc.setTitle(this.getName());
       sbc.getData().add(serie);
       sbc.setCategoryGap(0.2);
       sbc.setLegendVisible(false);
       return sbc;
       }
项目:jvarkit    文件:VariantDepthChartFactory.java   
@Override
public Chart build() {          
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("DP");
       final NumberAxis yAxis = new NumberAxis();
       yAxis.setLabel("Count");


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

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

       final BarChart<String, Number> sbc =
               new BarChart<String, Number>(xAxis, yAxis);
       sbc.setTitle(this.getName());
       sbc.getData().add(serie);
       sbc.setCategoryGap(0.2);
       sbc.setLegendVisible(false);
       return sbc;
       }
项目: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    文件:AFByPopulationChartFactory.java   
@Override
public Chart build() {          
    final CategoryAxis xAxis = new CategoryAxis();
    xAxis.setLabel("Population");
       final NumberAxis yAxis = new NumberAxis();
       yAxis.setLabel("Mean-MAF");

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

       for(int i=0;i< this.popcount.size();++i) {
        final PedFile.Status status = PedFile.Status.values()[i];
        double v=0;
        if(this.popcount.get(i).num_maf>0)
            {
            v=this.popcount.get(i).sum/((double)this.popcount.get(i).num_maf);
            }
        serie.getData().add(new XYChart.Data<String,Number>(
                status.name(),v)
                );

        }

       final BarChart<String, Number> sbc =
               new BarChart<String, Number>(xAxis, yAxis);
       sbc.setTitle(this.getName());
       sbc.getData().add(serie);
       sbc.setCategoryGap(0.2);
       sbc.setLegendVisible(false);
       return sbc;
       }
项目:jvarkit    文件:VariantTypeChartFactory.java   
@Override
public Chart build() {  
       final ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
       for(int i=0;i< categories.length;++i)
        {
        if(counts[i]==0) continue;
        pieChartData.add( new PieChart.Data(categories[i].getName() +" "+counts[i], counts[i]));
        }
       final PieChart chart = new PieChart(pieChartData);
       chart.setTitle(this.getName());
       chart.setLegendVisible(false);
       return chart;
    }
项目:jvarkit    文件:NgsStage.java   
protected void repaint()
{
final Chart chart= this.factory.build();
 Platform.runLater(new Runnable() {
     @Override
    public void run() {
        AbstractQualityStage.this.contentPane.setCenter(chart);
        AbstractQualityStage.this.countItemsLabel.setText("Running... Number of items: "+nItems);
        }
    });
}
项目:Recordian    文件:GraphsTabController.java   
@Override
public void initialize(URL location, ResourceBundle resources) {
    generateReportButton.setOnMouseClicked(event -> {
        // Find out which charts are currently shown to the user
        // and pass those charts to the generateReport method
        List<Chart> charts = new ArrayList<>();
        switch (chartType.getSelectedToggle().getUserData().toString()) {
            case BAR_CHART:
                charts.addAll(barCharts);
                break;
            case PIE_CHART:
                charts.addAll(pieCharts);
                break;
        }
        generateReport(charts);
    });

    // Set default chart view
    chartContainer.getChildren().addAll(barCharts);

    chartScrollPane.setFitToWidth(true);

    // Used to find out which radio button was selected
    barChartButton.setUserData(BAR_CHART);
    pieChartButton.setUserData(PIE_CHART);

    // Detect which radio button was selected and
    // add its corresponding charts to the chart container
    chartType.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
        switch (newValue.getUserData().toString()) {
            case BAR_CHART:
                chartContainer.getChildren().clear();
                chartContainer.getChildren().addAll(barCharts);
                break;
            case PIE_CHART:
                chartContainer.getChildren().clear();
                chartContainer.getChildren().addAll(pieCharts);
                break;
        }
    });
}
项目:campingsimulator2017    文件:ChartView.java   
/**
 * @return the chart
 */
public Chart getChart() {
    return 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;
    }