From c2c1f9cd0bcc38a410d479322943001c790f21eb Mon Sep 17 00:00:00 2001 From: winter <2436197699@qq.com> Date: Thu, 7 Mar 2024 12:02:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B5=8B=E8=AF=95=E7=BA=BF=E4=B8=8AJfre?= =?UTF-8?q?echart=E5=9B=BE=E8=A1=A8=E6=B1=89=E5=AD=97=E4=B9=B1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/EvaluationServiceImpl.java | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java b/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java index 2e1261a..1c4c5ed 100644 --- a/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java @@ -446,7 +446,6 @@ public class EvaluationServiceImpl implements EvaluationService { ); List content = appraiseRecordItemPage.getContent(); - return content; } @@ -660,6 +659,12 @@ public class EvaluationServiceImpl implements EvaluationService { praiseDistributionDataset.setValue(FiveEducations.ART.getName(), reportVo.getPraiseDistribution().get(FiveEducations.ART.getCode())); praiseDistributionDataset.setValue(FiveEducations.LABOUR.getName(), reportVo.getPraiseDistribution().get(FiveEducations.LABOUR.getCode())); JFreeChart praisePieChart = ChartUtil.pieChart("五育表扬指标分布", praiseDistributionDataset); + // 设置字体 + Font font = new Font("SimSun", Font.PLAIN, 12); + praisePieChart.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); + praisePieChart.getTitle().setFont(font); + praisePieChart.getLegend().setItemFont(font); + praisePieChart.getLegend().setItemPaint(Color.BLACK); PiePlot plot1 = (PiePlot) praisePieChart.getPlot(); plot1.setNoDataMessage("无数据"); plot1.setNoDataMessageFont(new Font("宋体", Font.PLAIN, 18)); @@ -675,6 +680,10 @@ public class EvaluationServiceImpl implements EvaluationService { criticalDistributionDataset.setValue(FiveEducations.ART.getName(), reportVo.getCriticalDistribution().get(FiveEducations.ART.getCode())); criticalDistributionDataset.setValue(FiveEducations.LABOUR.getName(), reportVo.getCriticalDistribution().get(FiveEducations.LABOUR.getCode())); JFreeChart criticalPieChart = ChartUtil.pieChart("五育待改进指标分布", criticalDistributionDataset); + criticalPieChart.getRenderingHints().put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); + criticalPieChart.getTitle().setFont(font); + criticalPieChart.getLegend().setItemFont(font); + criticalPieChart.getLegend().setItemPaint(Color.BLACK); PiePlot plot2 = (PiePlot) criticalPieChart.getPlot(); plot2.setNoDataMessage("无数据"); plot2.setNoDataMessageFont(new Font("宋体", Font.PLAIN, 18)); @@ -738,23 +747,5 @@ public class EvaluationServiceImpl implements EvaluationService { return children; } - /** - * 保证饼图分布:distribution 全部为 0,则初始化为 1 - */ - private void checkIfDistributionNull(Map distribution) { - boolean flag = false; - for (Map.Entry entry : distribution.entrySet()) { - if (entry.getValue() != 0) { - flag = true; - break; - } - } - - if(flag) { - return; - } - // distribution 全部为 0,则初始化为 1 - distribution.forEach((k, v) -> distribution.put(k, 1)); - } }