diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index fcd2ab34..e1cdbef2 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index 9925cca4..b871e42a 100644 Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe index a2e985ee..c7ebabb0 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe and b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll index fcd2ab34..e1cdbef2 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 e158ac2f..f5f2f31d 100644 --- a/SunnyUI/Charts/UIBarChart.cs +++ b/SunnyUI/Charts/UIBarChart.cs @@ -55,6 +55,9 @@ namespace Sunny.UI max = 0; } + if (!o.YAxis.MaxAuto) max = o.YAxis.Max; + if (!o.YAxis.MinAuto) min = o.YAxis.Min; + if ((max - min).IsZero()) { max = 100; diff --git a/SunnyUI/Charts/UIBarChartOption.cs b/SunnyUI/Charts/UIBarChartOption.cs index 4637dfb6..448cb643 100644 --- a/SunnyUI/Charts/UIBarChartOption.cs +++ b/SunnyUI/Charts/UIBarChartOption.cs @@ -77,6 +77,13 @@ namespace Sunny.UI public UIAxisTick AxisTick = new UIAxisTick(); public UIAxisLabel AxisLabel = new UIAxisLabel(); + + public bool MaxAuto { get; set; } = true; + public bool MinAuto { get; set; } = true; + + public double Max { get; set; } = 100; + public double Min { get; set; } = 0; + } public class UICategoryAxis : UIAxis @@ -92,8 +99,6 @@ namespace Sunny.UI { Data.Clear(); } - - } public class UIAxisLabel diff --git a/SunnyUI/Charts/UIPieChart.cs b/SunnyUI/Charts/UIPieChart.cs index 4ba842b0..f4f2e51e 100644 --- a/SunnyUI/Charts/UIPieChart.cs +++ b/SunnyUI/Charts/UIPieChart.cs @@ -137,18 +137,25 @@ namespace Sunny.UI double x = Math.Abs(Math.Sin(az * Math.PI / 180)); double y = Math.Abs(Math.Cos(az * Math.PI / 180)); - SizeF sf = g.MeasureString(pie.Data[0].Value.ToString("F0"), SubFont); - PointF pf; - if (az >= 0 && az < 90) - pf = new PointF((float)(DrawCenter(pie).X + RadiusSize(pie) * x + 6), (float)(DrawCenter(pie).Y - RadiusSize(pie) * y - sf.Height - 6)); - else if (az >= 90 && az < 180) - pf = new PointF((float)(DrawCenter(pie).X + RadiusSize(pie) * x + 6), (float)(DrawCenter(pie).Y + RadiusSize(pie) * y + 6)); - else if (az >= 180 && az < 270) - pf = new PointF((float)(DrawCenter(pie).X - RadiusSize(pie) * x - 6) - sf.Width, (float)(DrawCenter(pie).Y + RadiusSize(pie) * y + 6)); - else - pf = new PointF((float)(DrawCenter(pie).X - RadiusSize(pie) * x - 6) - sf.Width, (float)(DrawCenter(pie).Y - RadiusSize(pie) * y) - sf.Height - 6); + string name = Option.Legend != null ? Option.Legend.Data[azIndex] + " : " : ""; + if (pie.Data[azIndex].Value > 0) + { + string text = name + pie.Data[azIndex].Value.ToString("F0"); + SizeF sf = g.MeasureString(text, SubFont); + PointF pf; + int added = 9; + if (az >= 0 && az < 90) + pf = new PointF((float)(DrawCenter(pie).X + RadiusSize(pie) * x + added), (float)(DrawCenter(pie).Y - RadiusSize(pie) * y - sf.Height - added)); + else if (az >= 90 && az < 180) + pf = new PointF((float)(DrawCenter(pie).X + RadiusSize(pie) * x + added), (float)(DrawCenter(pie).Y + RadiusSize(pie) * y + added)); + else if (az >= 180 && az < 270) + pf = new PointF((float)(DrawCenter(pie).X - RadiusSize(pie) * x - added) - sf.Width, (float)(DrawCenter(pie).Y + RadiusSize(pie) * y + added)); + else + pf = new PointF((float)(DrawCenter(pie).X - RadiusSize(pie) * x - added) - sf.Width, (float)(DrawCenter(pie).Y - RadiusSize(pie) * y) - sf.Height - added); - g.DrawString(pie.Data[azIndex].Value.ToString("F0"), SubFont, color, pf.X, pf.Y); + if (pie.Data[azIndex].Value > 0) + g.DrawString(text, SubFont, color, pf.X, pf.Y); + } } } } diff --git a/SunnyUI/Controls/UINavBar.cs b/SunnyUI/Controls/UINavBar.cs index 187ece3d..cdc9aed3 100644 --- a/SunnyUI/Controls/UINavBar.cs +++ b/SunnyUI/Controls/UINavBar.cs @@ -433,7 +433,7 @@ namespace Sunny.UI return; } - NavBarMenu.Style = Style; + NavBarMenu.Style = UIStyles.Style; NavBarMenu.Items.Clear(); foreach (TreeNode node in Nodes[SelectedIndex].Nodes) {