fix: 饼图无数据时给与提示

11111
winter 10 months ago
parent fa1c6a9b20
commit 32f2414cd8

@ -660,6 +660,9 @@ public class EvaluationServiceImpl implements EvaluationService {
praiseDistributionDataset.setValue(FiveEducations.ART.getName(), reportVo.getPraiseDistribution().get(FiveEducations.ART.getCode())); praiseDistributionDataset.setValue(FiveEducations.ART.getName(), reportVo.getPraiseDistribution().get(FiveEducations.ART.getCode()));
praiseDistributionDataset.setValue(FiveEducations.LABOUR.getName(), reportVo.getPraiseDistribution().get(FiveEducations.LABOUR.getCode())); praiseDistributionDataset.setValue(FiveEducations.LABOUR.getName(), reportVo.getPraiseDistribution().get(FiveEducations.LABOUR.getCode()));
JFreeChart praisePieChart = ChartUtil.pieChart("五育表扬指标分布", praiseDistributionDataset); JFreeChart praisePieChart = ChartUtil.pieChart("五育表扬指标分布", praiseDistributionDataset);
PiePlot plot1 = (PiePlot) praisePieChart.getPlot();
plot1.setNoDataMessage("无数据");
plot1.setNoDataMessageFont(new Font("宋体", Font.PLAIN, 18));
ByteArrayOutputStream praiseBos = new ByteArrayOutputStream(); ByteArrayOutputStream praiseBos = new ByteArrayOutputStream();
ChartUtils.writeChartAsJPEG(praiseBos, praisePieChart, 340, 330); ChartUtils.writeChartAsJPEG(praiseBos, praisePieChart, 340, 330);
@ -672,9 +675,9 @@ public class EvaluationServiceImpl implements EvaluationService {
criticalDistributionDataset.setValue(FiveEducations.ART.getName(), reportVo.getCriticalDistribution().get(FiveEducations.ART.getCode())); criticalDistributionDataset.setValue(FiveEducations.ART.getName(), reportVo.getCriticalDistribution().get(FiveEducations.ART.getCode()));
criticalDistributionDataset.setValue(FiveEducations.LABOUR.getName(), reportVo.getCriticalDistribution().get(FiveEducations.LABOUR.getCode())); criticalDistributionDataset.setValue(FiveEducations.LABOUR.getName(), reportVo.getCriticalDistribution().get(FiveEducations.LABOUR.getCode()));
JFreeChart criticalPieChart = ChartUtil.pieChart("五育待改进指标分布", criticalDistributionDataset); JFreeChart criticalPieChart = ChartUtil.pieChart("五育待改进指标分布", criticalDistributionDataset);
PiePlot plot = (PiePlot) criticalPieChart.getPlot(); PiePlot plot2 = (PiePlot) criticalPieChart.getPlot();
plot.setNoDataMessage("无数据"); plot2.setNoDataMessage("无数据");
plot.setNoDataMessageFont(new Font("宋体", Font.PLAIN, 18)); plot2.setNoDataMessageFont(new Font("宋体", Font.PLAIN, 18));
ByteArrayOutputStream criticalBos = new ByteArrayOutputStream(); ByteArrayOutputStream criticalBos = new ByteArrayOutputStream();
ChartUtils.writeChartAsJPEG(criticalBos, criticalPieChart, 340, 330); ChartUtils.writeChartAsJPEG(criticalBos, criticalPieChart, 340, 330);
@ -684,7 +687,7 @@ public class EvaluationServiceImpl implements EvaluationService {
PdfUtil.fillImage(stamper, "praiseDistribution", praiseBos.toByteArray()); PdfUtil.fillImage(stamper, "praiseDistribution", praiseBos.toByteArray());
PdfUtil.fillImage(stamper, "criticalDistribution", criticalBos.toByteArray()); PdfUtil.fillImage(stamper, "criticalDistribution", criticalBos.toByteArray());
// 关闭流 // 关闭流
// stamper.setFormFlattening(true); stamper.setFormFlattening(true);
stamper.close(); stamper.close();
os.close(); os.close();
} }

Loading…
Cancel
Save