diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 0b7a09cd..57a1f4dd 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index 49083564..f073c8fb 100644 Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll index 0b7a09cd..57a1f4dd 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI/Charts/UIBarChart.cs b/SunnyUI/Charts/UIBarChart.cs index f5f2f31d..e89a3737 100644 --- a/SunnyUI/Charts/UIBarChart.cs +++ b/SunnyUI/Charts/UIBarChart.cs @@ -196,36 +196,43 @@ namespace Sunny.UI { base.OnMouseMove(e); - if (BarOption.ToolTip == null) return; - if (e.Location.X > BarOption.Grid.Left && e.Location.X < Width - BarOption.Grid.Right - && e.Location.Y > BarOption.Grid.Top && - e.Location.Y < Height - BarOption.Grid.Bottom) + try { - SelectIndex = (int)((e.Location.X - BarOption.Grid.Left) / DrawBarWidth); - } - else - { - SelectIndex = -1; - } - - if (SelectIndex >= 0) - { - if (tip.Text != Bars[0][selectIndex].Tips) + if (BarOption.ToolTip == null) return; + if (e.Location.X > BarOption.Grid.Left && e.Location.X < Width - BarOption.Grid.Right + && e.Location.Y > BarOption.Grid.Top && + e.Location.Y < Height - BarOption.Grid.Bottom) { - tip.Text = Bars[0][selectIndex].Tips; - tip.Size = new Size((int)Bars[0][selectIndex].Size.Width + 4, (int)Bars[0][selectIndex].Size.Height + 4); + SelectIndex = (int)((e.Location.X - BarOption.Grid.Left) / DrawBarWidth); + } + else + { + SelectIndex = -1; } - int x = e.Location.X + 15; - int y = e.Location.Y + 20; - if (e.Location.X + 15 + tip.Width > Width - BarOption.Grid.Right) - x = e.Location.X - tip.Width - 2; - if (e.Location.Y + 20 + tip.Height > Height - BarOption.Grid.Bottom) - y = e.Location.Y - tip.Height - 2; + if (SelectIndex >= 0 && Bars.Count > 0) + { + if (tip.Text != Bars[0][selectIndex].Tips) + { + tip.Text = Bars[0][selectIndex].Tips; + tip.Size = new Size((int)Bars[0][selectIndex].Size.Width + 4, (int)Bars[0][selectIndex].Size.Height + 4); + } - tip.Left = x; - tip.Top = y; - if (!tip.Visible) tip.Visible = Bars[0][selectIndex].Tips.IsValid(); + int x = e.Location.X + 15; + int y = e.Location.Y + 20; + if (e.Location.X + 15 + tip.Width > Width - BarOption.Grid.Right) + x = e.Location.X - tip.Width - 2; + if (e.Location.Y + 20 + tip.Height > Height - BarOption.Grid.Bottom) + y = e.Location.Y - tip.Height - 2; + + tip.Left = x; + tip.Top = y; + if (!tip.Visible) tip.Visible = Bars[0][selectIndex].Tips.IsValid(); + } + } + catch (Exception exception) + { + Console.WriteLine(exception); } } diff --git a/SunnyUI/Charts/UIOption.cs b/SunnyUI/Charts/UIOption.cs index 4d091f34..0a23454a 100644 --- a/SunnyUI/Charts/UIOption.cs +++ b/SunnyUI/Charts/UIOption.cs @@ -36,6 +36,7 @@ namespace Sunny.UI public double Value { get; set; } public string Name { get; set; } public Color Color { get; set; } + public UILeftAlignment Left { get; set; } } public class UILegend diff --git a/SunnyUI/Charts/UIPieChart.cs b/SunnyUI/Charts/UIPieChart.cs index f4f2e51e..0188e81c 100644 --- a/SunnyUI/Charts/UIPieChart.cs +++ b/SunnyUI/Charts/UIPieChart.cs @@ -68,6 +68,8 @@ namespace Sunny.UI DrawLegend(g, PieOption.Legend); } + private bool AllIsZero; + protected override void CalcData(UIOption option) { Angles.Clear(); @@ -85,6 +87,7 @@ namespace Sunny.UI all += data.Value; } + AllIsZero = all.IsZero(); if (all.IsZero()) return; float start = 0; for (int i = 0; i < pie.Data.Count; i++) @@ -120,6 +123,17 @@ namespace Sunny.UI { if (series == null || series.Count == 0) return; + if (AllIsZero) + { + if (series.Count > 0) + { + RectangleF rect = GetSeriesRect(series[0]); + g.DrawEllipse(Color.Red, rect); + } + + return; + } + for (int pieIndex = 0; pieIndex < series.Count; pieIndex++) { var pie = series[pieIndex]; @@ -184,6 +198,8 @@ namespace Sunny.UI return; } + if (AllIsZero) return; + for (int pieIndex = 0; pieIndex < PieOption.SeriesCount; pieIndex++) { RectangleF rect = GetSeriesRect(PieOption.Series[pieIndex]); diff --git a/SunnyUI/Controls/UIRadioButton.cs b/SunnyUI/Controls/UIRadioButton.cs index 1a5660fe..92c958ae 100644 --- a/SunnyUI/Controls/UIRadioButton.cs +++ b/SunnyUI/Controls/UIRadioButton.cs @@ -179,6 +179,8 @@ namespace Sunny.UI { Checked = true; } + + base.OnClick(e); } public override void SetStyleColor(UIBaseStyle uiColor)