From ce7cbd9e1150b3a7c0116d55b688edd5748403dc Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 6 Jun 2023 22:10:32 +0800 Subject: [PATCH] =?UTF-8?q?*=20UILineChart:=20=E4=BF=AE=E5=A4=8DX=E8=BD=B4?= =?UTF-8?q?=E6=96=87=E5=AD=97=E9=87=8D=E5=8F=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Charts/UILineChart.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SunnyUI/Charts/UILineChart.cs b/SunnyUI/Charts/UILineChart.cs index 08483e69..ac007a7e 100644 --- a/SunnyUI/Charts/UILineChart.cs +++ b/SunnyUI/Charts/UILineChart.cs @@ -44,6 +44,7 @@ * 2023-04-23: V3.3.5 打开Smooth绘制,建议数据差距不大时可平滑绘制 * 2023-05-12: V3.3.6 增加了一种开关量曲线的显示方式 * 2023-05-14: V3.3.6 重构DrawString函数 + * 2023-06-06: V3.3.7 修复X轴文字重叠问题 ******************************************************************************/ using System; @@ -339,10 +340,11 @@ namespace Sunny.UI label = Option.XAxis.CustomLabels.GetLabel(i); } - Size sf = TextRenderer.MeasureText(label, TempFont); + SizeF sf = TextRenderer.MeasureText(label, TempFont); float xx = x - sf.Width / 2.0f; if (xx > xr && xx + sf.Width < Width) { + xr = xx + sf.Width; g.DrawString(label, TempFont, ForeColor, new Rectangle((int)x - Width, DrawOrigin.Y + Option.XAxis.AxisTick.Length, Width * 2, Height), ContentAlignment.TopCenter); } }