* UIPieChart:更改Tips显示不正确的Bug

This commit is contained in:
Sunny 2020-07-05 23:26:49 +08:00
parent 3b285175b6
commit 2ca8303735
6 changed files with 39 additions and 37 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -53,11 +53,6 @@ namespace Sunny.UI
Angles.Clear(); Angles.Clear();
UIDoughnutOption o = (UIDoughnutOption)option; UIDoughnutOption o = (UIDoughnutOption)option;
if (o == null || o.Series == null || o.Series.Count == 0) return; if (o == null || o.Series == null || o.Series.Count == 0) return;
UITemplate template = null;
if (o.ToolTip != null)
{
template = new UITemplate(o.ToolTip.Formatter);
}
for (int pieIndex = 0; pieIndex < o.Series.Count; pieIndex++) for (int pieIndex = 0; pieIndex < o.Series.Count; pieIndex++)
{ {
@ -81,14 +76,12 @@ namespace Sunny.UI
{ {
try try
{ {
if (template != null) UITemplate template = new UITemplate(o.ToolTip.Formatter);
{ template.Set("a", pie.Name);
template.Set("a", pie.Name); template.Set("b", pie.Data[i].Name);
template.Set("b", pie.Data[i].Name); template.Set("c", pie.Data[i].Value.ToString(o.ToolTip.ValueFormat));
template.Set("c", pie.Data[i].Value.ToString(o.ToolTip.ValueFormat)); template.Set("d", percent.ToString("F2"));
template.Set("d", percent.ToString("F2")); text = template.Render();
text = template.Render();
}
} }
catch catch
{ {
@ -119,7 +112,7 @@ namespace Sunny.UI
Color color = ChartStyle.SeriesColor[azIndex % ChartStyle.ColorCount]; Color color = ChartStyle.SeriesColor[azIndex % ChartStyle.ColorCount];
if (ActiveAzIndex == azIndex) if (ActiveAzIndex == azIndex)
g.FillFan(color, angle.Center, angle.Inner, angle.Outer+5, angle.Start-90, angle.Sweep); g.FillFan(color, angle.Center, angle.Inner, angle.Outer + 5, angle.Start - 90, angle.Sweep);
else else
g.FillFan(color, angle.Center, angle.Inner, angle.Outer, angle.Start - 90, angle.Sweep); g.FillFan(color, angle.Center, angle.Inner, angle.Outer, angle.Start - 90, angle.Sweep);
@ -130,12 +123,10 @@ namespace Sunny.UI
if (pie.Label.Position == UIPieSeriesLabelPosition.Center) if (pie.Label.Position == UIPieSeriesLabelPosition.Center)
{ {
SizeF sf = g.MeasureString(pie.Data[azIndex].Name, Font); SizeF sf = g.MeasureString(pie.Data[azIndex].Name, Font);
g.DrawString(pie.Data[azIndex].Name, Font, color, angle.Center.X- sf.Width/2.0f,angle.Center.Y-sf.Height/2.0f); g.DrawString(pie.Data[azIndex].Name, Font, color, angle.Center.X - sf.Width / 2.0f, angle.Center.Y - sf.Height / 2.0f);
} }
} }
} }
} }
} }
@ -179,7 +170,7 @@ namespace Sunny.UI
tip.Text = angle.Text; tip.Text = angle.Text;
tip.Size = new Size((int)angle.TextSize.Width + 4, (int)angle.TextSize.Height + 4); tip.Size = new Size((int)angle.TextSize.Width + 4, (int)angle.TextSize.Height + 4);
} }
if (az >= 0 && az < 90) if (az >= 0 && az < 90)
{ {
tip.Top = e.Location.Y + 20; tip.Top = e.Location.Y + 20;
@ -200,7 +191,7 @@ namespace Sunny.UI
tip.Left = e.Location.X + 15; tip.Left = e.Location.X + 15;
tip.Top = e.Location.Y + 20; tip.Top = e.Location.Y + 20;
} }
if (!tip.Visible) tip.Visible = angle.Text.IsValid(); if (!tip.Visible) tip.Visible = angle.Text.IsValid();
return; return;
} }

View File

@ -63,9 +63,9 @@ namespace Sunny.UI
protected override void DrawOption(Graphics g) protected override void DrawOption(Graphics g)
{ {
if (PieOption == null) return; if (PieOption == null) return;
DrawTitle(g, PieOption.Title); DrawTitle(g, PieOption.Title);
DrawSeries(g, PieOption.Series); DrawSeries(g, PieOption.Series);
DrawLegend(g, PieOption.Legend); DrawLegend(g, PieOption.Legend);
} }
protected override void CalcData(UIOption option) protected override void CalcData(UIOption option)
@ -73,11 +73,6 @@ namespace Sunny.UI
Angles.Clear(); Angles.Clear();
UIPieOption o = (UIPieOption)option; UIPieOption o = (UIPieOption)option;
if (o == null || o.Series == null || o.Series.Count == 0) return; if (o == null || o.Series == null || o.Series.Count == 0) return;
UITemplate template = null;
if (o.ToolTip != null)
{
template = new UITemplate(o.ToolTip.Formatter);
}
for (int pieIndex = 0; pieIndex < o.Series.Count; pieIndex++) for (int pieIndex = 0; pieIndex < o.Series.Count; pieIndex++)
{ {
@ -101,14 +96,12 @@ namespace Sunny.UI
{ {
try try
{ {
if (template != null) UITemplate template = new UITemplate(o.ToolTip.Formatter);
{ template.Set("a", pie.Name);
template.Set("a", pie.Name); template.Set("b", pie.Data[i].Name);
template.Set("b", pie.Data[i].Name); template.Set("c", pie.Data[i].Value.ToString(o.ToolTip.ValueFormat));
template.Set("c", pie.Data[i].Value.ToString(o.ToolTip.ValueFormat)); template.Set("d", percent.ToString("F2"));
template.Set("d", percent.ToString("F2")); text = template.Render();
text = template.Render();
}
} }
catch catch
{ {
@ -143,8 +136,6 @@ namespace Sunny.UI
private readonly ConcurrentDictionary<int, ConcurrentDictionary<int, Angle>> Angles = new ConcurrentDictionary<int, ConcurrentDictionary<int, Angle>>(); private readonly ConcurrentDictionary<int, ConcurrentDictionary<int, Angle>> Angles = new ConcurrentDictionary<int, ConcurrentDictionary<int, Angle>>();
[Browsable(false)] [Browsable(false)]
private UIPieOption PieOption private UIPieOption PieOption
{ {

View File

@ -1,5 +1,25 @@
+ 增加; - 删除; * 修改 + 增加; - 删除; * 修改
2020-07-04
* UICheckBoxGroup,UIRadioButtonGroup可以设置初始选中值
* UILedBulb边缘平滑
* UIRichTextBox增加一些函数
2020-07-03
* UIRadioButtonGroup,UICheckBoxGroup修正调整ItemSize无效的Bug
2020-07-02
* UIForm修正控件位置在标题栏下方
2020-07-01
* UIForm修改标题栏按钮背景色刷新
* UIForm仿照QQ重绘标题栏按钮。
* UINavMenuOnAfterSelect增加判断解决引发事件所有结点重绘导致闪烁设置FullRowSelect ShowLin…
* OnAfterSelect增加判断解决引发事件所有结点重绘导致闪烁设置FullRowSelect ShowLines 属性,解决滚轮失效问题。
* UIForm修改不显示标题时的控件在顶部的位置Bug
* 修改最大化全屏时消息窗体弹出在窗体后的BUG
* 修改最大化全屏时消息窗体弹出在窗体后的BUG
2020.06.29 V2.2.5->V2.2.6 2020.06.29 V2.2.5->V2.2.6
+ UIDoughnutChart环状图 + UIDoughnutChart环状图
+ UILoginForm登录窗体 + UILoginForm登录窗体