From 73e810fc9569597be99accd08d63aab6e7c0daac Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期二, 06 十月 2026 09:36:41 +0800
Subject: [PATCH] fix(holiday): 提高平均拥挤度走势图标签精度
---
traffic-audit-server/src/test/java/com/trafficaudit/holiday/service/HolidayTrendChartServiceTest.java | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/traffic-audit-server/src/test/java/com/trafficaudit/holiday/service/HolidayTrendChartServiceTest.java b/traffic-audit-server/src/test/java/com/trafficaudit/holiday/service/HolidayTrendChartServiceTest.java
index e705637..29a8ff1 100644
--- a/traffic-audit-server/src/test/java/com/trafficaudit/holiday/service/HolidayTrendChartServiceTest.java
+++ b/traffic-audit-server/src/test/java/com/trafficaudit/holiday/service/HolidayTrendChartServiceTest.java
@@ -6,6 +6,7 @@
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -40,6 +41,26 @@
assertNoLargeLightGrayBackground(stacked);
}
+ @Test
+ void rendersHigherPrecisionLineLabelsWhenRequested() {
+ HolidayTrendChartService service = new HolidayTrendChartService();
+ HolidayTrendChartService.ChartSeries congestion = new HolidayTrendChartService.ChartSeries();
+ congestion.setName("骞冲潎鎷ユ尋搴�");
+ congestion.setValues(java.util.Arrays.asList(
+ new java.math.BigDecimal("0.467029"),
+ new java.math.BigDecimal("0.490890"),
+ new java.math.BigDecimal("0.492414")));
+
+ byte[] twoDecimals = service.lineChart("鎷ユ尋搴�",
+ java.util.Collections.singletonList(congestion), false, 2, 1100, 590);
+ byte[] threeDecimals = service.lineChart("鎷ユ尋搴�",
+ java.util.Collections.singletonList(congestion), false, 3, 1100, 590);
+
+ assertPng(twoDecimals);
+ assertPng(threeDecimals);
+ assertFalse(java.util.Arrays.equals(twoDecimals, threeDecimals));
+ }
+
private void assertNoLargeLightGrayBackground(byte[] data) throws Exception {
BufferedImage image = ImageIO.read(new ByteArrayInputStream(data));
int matches = 0;
--
Gitblit v1.9.1