Search in sources :

Example 6 with StackedBarChart

use of javafx.scene.chart.StackedBarChart in project jvarkit by lindenb.

the class GenotypeTypeChartFactory method build.

@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;
}
Also used : NumberAxis(javafx.scene.chart.NumberAxis) ArrayList(java.util.ArrayList) StackedBarChart(javafx.scene.chart.StackedBarChart) CategoryAxis(javafx.scene.chart.CategoryAxis) GenotypeType(htsjdk.variant.variantcontext.GenotypeType) XYChart(javafx.scene.chart.XYChart)

Example 7 with StackedBarChart

use of javafx.scene.chart.StackedBarChart in project jvarkit by lindenb.

the class ReadLengthChartFactory method build.

@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;
}
Also used : NumberAxis(javafx.scene.chart.NumberAxis) CategoryAxis(javafx.scene.chart.CategoryAxis) TreeSet(java.util.TreeSet) StackedBarChart(javafx.scene.chart.StackedBarChart) XYChart(javafx.scene.chart.XYChart)

Example 8 with StackedBarChart

use of javafx.scene.chart.StackedBarChart in project jvarkit by lindenb.

the class SamFlagsChartFactory method build.

@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;
}
Also used : NumberAxis(javafx.scene.chart.NumberAxis) CategoryAxis(javafx.scene.chart.CategoryAxis) TreeSet(java.util.TreeSet) StackedBarChart(javafx.scene.chart.StackedBarChart) XYChart(javafx.scene.chart.XYChart)

Aggregations

StackedBarChart (javafx.scene.chart.StackedBarChart)8 CategoryAxis (javafx.scene.chart.CategoryAxis)7 NumberAxis (javafx.scene.chart.NumberAxis)7 XYChart (javafx.scene.chart.XYChart)7 ArrayList (java.util.ArrayList)5 TreeSet (java.util.TreeSet)2 CigarOperator (htsjdk.samtools.CigarOperator)1 GenotypeType (htsjdk.variant.variantcontext.GenotypeType)1 SeriesDataSet (kutch.biff.marvin.utility.SeriesDataSet)1