* 修改图表控件的一些小BUG
This commit is contained in:
parent
26c2013848
commit
7c5d84185f
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
BIN
Bin/SunnyUI.pdb
BIN
Bin/SunnyUI.pdb
Binary file not shown.
Binary file not shown.
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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]);
|
||||
|
@ -179,6 +179,8 @@ namespace Sunny.UI
|
||||
{
|
||||
Checked = true;
|
||||
}
|
||||
|
||||
base.OnClick(e);
|
||||
}
|
||||
|
||||
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||
|
Loading…
x
Reference in New Issue
Block a user