Search in sources :

Example 6 with DRDataSource

use of net.sf.dynamicreports.report.datasource.DRDataSource in project hmftools by hartwigmedical.

the class GradientBar method build.

@NotNull
public ComponentBuilder<?, ?> build() {
    final TextColumnBuilder<String> itemColumn = col.column("item", "item", String.class);
    final TextColumnBuilder<Integer> valueColumn = col.column("value", "value", Integer.class);
    final DRDataSource dataSource = new DRDataSource("item", "value");
    dataSource.add("value", 100);
    final GradientPaint gradientPaint = new GradientPaint(0, 0, startColor(), 10, 0, endColor());
    final GradientBarCustomizer customizer = ImmutableGradientBarCustomizer.of(gradientPaint, startText(), endText(), value(), marker());
    return cht.barChart().customizers(customizer).setCategory(itemColumn).series(cht.serie(valueColumn)).setHeight(39).setDataSource(dataSource);
}
Also used : DRDataSource(net.sf.dynamicreports.report.datasource.DRDataSource) GradientPaint(java.awt.GradientPaint) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with DRDataSource

use of net.sf.dynamicreports.report.datasource.DRDataSource in project hmftools by hartwigmedical.

the class VariantDataSource method fromVariants.

@NotNull
public static JRDataSource fromVariants(@NotNull final List<VariantReport> variantReports, @NotNull DrupFilter drupFilter) {
    final DRDataSource variantDataSource = new DRDataSource(GENE_FIELD.getName(), POSITION_FIELD.getName(), VARIANT_FIELD.getName(), DEPTH_VAF_FIELD.getName(), COSMIC_FIELD.getName(), COSMIC_NR_FIELD.getName(), HGVS_CODING_FIELD.getName(), HGVS_PROTEIN_FIELD.getName(), CONSEQUENCE_FIELD.getName(), PLOIDY_TAF_FIELD.getName());
    for (final VariantReport variantReport : variantReports) {
        final String displayGene = drupFilter.test(variantReport) ? variantReport.gene() + " *" : variantReport.gene();
        variantDataSource.add(displayGene, variantReport.variant().chromosomePosition(), variantReport.variantField(), variantReport.depthVafField(), variantReport.cosmicID(), stripCosmicIdentifier(variantReport.cosmicID()), variantReport.hgvsCoding(), variantReport.hgvsProtein(), variantReport.consequence(), variantReport.ploidyTafField());
    }
    return variantDataSource;
}
Also used : VariantReport(com.hartwig.hmftools.patientreporter.variants.VariantReport) DRDataSource(net.sf.dynamicreports.report.datasource.DRDataSource) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DRDataSource (net.sf.dynamicreports.report.datasource.DRDataSource)7 NotNull (org.jetbrains.annotations.NotNull)7 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 HmfGenomeRegion (com.hartwig.hmftools.common.region.hmfslicer.HmfGenomeRegion)1 VariantReport (com.hartwig.hmftools.patientreporter.variants.VariantReport)1 GradientPaint (java.awt.GradientPaint)1