1

ガント チャートのパーセント バーの色を変更する方法について教えてください。動的レポート API を使用してレポートを PDF 形式で生成しています。

プログレスバーの色を変更する必要があります。常に緑色で表示され、変更したいと考えています。

 private JasperReportBuilder build(){
 JasperReportBuilder report = DynamicReports.report();
 TextColumnBuilder<String> uName = col.column("Name", "name", type.stringType()).setHorizontalAlignment(HorizontalAlignment.LEFT);
            TextColumnBuilder<Date> uStart = col.column("Start", "start", type.dateType());
            TextColumnBuilder<Date> uEnd = col.column("End", "end", type.dateType());
            TextColumnBuilder<Double> uProgress = col.column("Progress", "progress", type.doubleType());

            GanttChartBuilder chart2 = cht.ganttChart().customizers(new ChartCustomizer())
                .setTask(uName)
                .series(
                    cht.ganttSerie()
                        .setStartDate(uStart)
                        .setEndDate(uEnd)
                        .setPercent(uProgress)
                        ).seriesColors(new Color(163,209,255)).setDataSource(createDataSourceForGanntChart(initiativeList,initiativeGroup,periodId,subPeriodId,fullPath,model))
                .setTimeAxisFormat(
                    cht.axisFormat().setLabel(objectInitiativeChart.getCategoryLabel()))
                .setTaskAxisFormat(
                    cht.axisFormat().setLabel(objectInitiativeChart.getSeriesLabel()));

                report.summary(chart2);
return report;
}

private class ChartCustomizer implements DRIChartCustomizer, Serializable {

  private static final long serialVersionUID = 1L;
    @Override
    public void customize(JFreeChart chart, ReportParameters reportParameters) {

    BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
    renderer.setMaximumBarWidth(0.1);
    org.jfree.chart.axis.CategoryAxis domainAxis = chart.getCategoryPlot().getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    domainAxis.setCategoryMargin(-0.5d);
  }

}  

このコードを適用した後の画像。 緑色を別の色に置き換えたい

4

1 に答える 1