use of com.github.lindenb.jvarkit.chart.Chart in project jvarkit by lindenb.
the class BamStatsJfx method save.
private void save() throws IOException {
try (final PrintWriter pw = super.openFileOrStdoutAsPrintWriter(this.outputFile)) {
final RExporter exporter = new RExporter();
for (final ChartGenerator cg : this.chartGenerators) {
LOG.info("saving " + cg.getChartTitle());
if (!cg.isEnabled())
continue;
final Chart chart = cg.makeChart();
if (chart == null)
continue;
exporter.exportToR(pw, chart);
}
pw.flush();
}
}
use of com.github.lindenb.jvarkit.chart.Chart in project jvarkit by lindenb.
the class VcfStatsJfx method save.
private void save() throws IOException {
try (final PrintWriter pw = super.openFileOrStdoutAsPrintWriter(this.outputFile)) {
final RExporter exporter = new RExporter();
for (final ChartGenerator cg : this.chartGenerators) {
LOG.info("saving " + cg.getChartTitle());
if (!cg.isEnabled())
continue;
final Chart chart = cg.makeChart();
if (chart == null)
continue;
exporter.exportToR(pw, chart);
}
pw.flush();
}
}
use of com.github.lindenb.jvarkit.chart.Chart in project jvarkit by lindenb.
the class SimplePlot method doWork.
@Override
public int doWork(final List<String> args) {
Chart chartNode = null;
try {
final BufferedReader br = super.openBufferedReader(oneFileOrNull(args));
this.lineSupplier = () -> {
try {
for (; ; ) {
final String L = br.readLine();
if (L == null)
return null;
return L;
}
} catch (final IOException err) {
throw new RuntimeIOException(err);
}
};
switch(this.chartType) {
case BEDGRAPH:
{
chartNode = new BedGraphSupplier().get();
break;
}
case PIE:
chartNode = new PieChartSupplier().get();
break;
case SIMPLE_HISTOGRAM:
chartNode = new SimpleHistogramSupplier().get();
break;
case HISTOGRAM:
chartNode = new HistogramSupplier().get();
break;
case STACKED_HISTOGRAM:
chartNode = new StackedHistogramSupplier().get();
break;
case STACKED_HISTOGRAM_PIVOTED:
chartNode = new StackedHistogramPivoted().get();
break;
case XYV:
case STACKED_XYV:
chartNode = new XYVHistogramSupplier().setStacked(this.chartType == PlotType.STACKED_XYV).get();
break;
case HEATMAP:
chartNode = new HeatmapSupplier().get();
break;
default:
{
LOG.error("Bad chart type : " + this.chartType);
return -1;
}
}
CloserUtil.close(br);
if (chartNode == null) {
LOG.error("No chart was generated");
return -1;
}
if (StringUtil.isBlank(this.chartTitle)) {
chartNode.setLegendVisible(false);
} else {
// chart.setTitleSide(this.titleSide);
chartNode.setTitle(this.chartTitle);
}
// chart.setLegendSide(this.legendSide);
chartNode.setLegendVisible(!this.hide_legend);
try (PrintWriter pw = super.openFileOrStdoutAsPrintWriter(this.outputFile)) {
final RExporter exporter = new RExporter();
exporter.exportToR(pw, chartNode);
pw.flush();
}
} catch (final Exception err) {
LOG.error(err);
return -1;
} finally {
}
return 0;
}
Aggregations