* UIChart:重构了图表的ToolTip显示
This commit is contained in:
parent
3828b68355
commit
c624475be3
Binary file not shown.
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
@ -48,7 +48,7 @@ namespace Sunny.UI.Demo.Charts
|
||||
option.XAxis.Data.Add("Thu");
|
||||
option.XAxis.Data.Add("Fri");
|
||||
|
||||
option.ToolTip = new UIBarToolTip();
|
||||
option.ToolTip.Visible = true;
|
||||
option.YAxis.Scale = true;
|
||||
|
||||
option.XAxis.Name = "日期";
|
||||
|
@ -73,7 +73,7 @@ namespace Sunny.UI.Demo
|
||||
option.XAxis.Data.Add("Thu");
|
||||
option.XAxis.Data.Add("Fri");
|
||||
|
||||
option.ToolTip = new UIBarToolTip();
|
||||
option.ToolTip.Visible = true;
|
||||
option.YAxis.Scale = true;
|
||||
|
||||
option.XAxis.Name = "日期";
|
||||
|
@ -18,7 +18,7 @@
|
||||
option.Title.Left = UILeftAlignment.Center;
|
||||
|
||||
//设置ToolTip
|
||||
option.ToolTip = new UIPieToolTip();
|
||||
option.ToolTip.Visible = true;
|
||||
|
||||
//设置Legend
|
||||
option.Legend = new UILegend();
|
||||
|
@ -14,7 +14,7 @@ namespace Sunny.UI.Demo.Charts
|
||||
private void uiSymbolButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
UILineOption option = new UILineOption();
|
||||
option.ToolTip = new UIBarToolTip();
|
||||
option.ToolTip.Visible = true;
|
||||
option.Title = new UITitle();
|
||||
option.Title.Text = "SunnyUI";
|
||||
option.Title.SubText = "LineChart";
|
||||
|
@ -33,7 +33,7 @@
|
||||
option.Title.Left = UILeftAlignment.Center;
|
||||
|
||||
//设置ToolTip
|
||||
option.ToolTip = new UIPieToolTip();
|
||||
option.ToolTip.Visible = true;
|
||||
|
||||
//设置Legend
|
||||
option.Legend = new UILegend();
|
||||
|
@ -274,7 +274,7 @@ namespace Sunny.UI
|
||||
|
||||
try
|
||||
{
|
||||
if (BarOption.ToolTip == null) return;
|
||||
if (!BarOption.ToolTip.Visible) 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)
|
||||
|
@ -481,7 +481,7 @@ namespace Sunny.UI
|
||||
{
|
||||
try
|
||||
{
|
||||
if (BarOption.ToolTip == null) return;
|
||||
if (!BarOption.ToolTip.Visible) return;
|
||||
if (e.Location.X > BarOption.Grid.Left &&
|
||||
e.Location.X < Width - BarOption.Grid.Right &&
|
||||
e.Location.Y > BarOption.Grid.Top &&
|
||||
|
@ -29,7 +29,7 @@ namespace Sunny.UI
|
||||
{
|
||||
public UIAxis XAxis { get; set; } = new UIAxis(UIAxisType.Category);
|
||||
|
||||
public UIBarToolTip ToolTip { get; set; }
|
||||
public UIBarToolTip ToolTip { get; set; } = new UIBarToolTip();
|
||||
|
||||
public UIAxis YAxis { get; set; } = new UIAxis(UIAxisType.Value);
|
||||
|
||||
@ -69,13 +69,15 @@ namespace Sunny.UI
|
||||
public int SeriesCount => Series.Count;
|
||||
}
|
||||
|
||||
public class UIBarToolTip
|
||||
public class UIBarToolTip : UIChartToolTip
|
||||
{
|
||||
public string Formatter { get; set; } = "{{b}} : {{c}}";
|
||||
|
||||
public string ValueFormat { get; set; } = "F0";
|
||||
|
||||
public UIAxisPointer AxisPointer = new UIAxisPointer();
|
||||
|
||||
public UIBarToolTip()
|
||||
{
|
||||
Formatter = "{{b}} : {{c}}";
|
||||
ValueFormat = "F0";
|
||||
}
|
||||
}
|
||||
|
||||
public class UIAxisPointer
|
||||
|
@ -214,7 +214,11 @@ namespace Sunny.UI
|
||||
tip.Top = e.Location.Y + 20;
|
||||
}
|
||||
|
||||
if (DoughnutOption.ToolTip.Visible)
|
||||
{
|
||||
if (!tip.Visible) tip.Visible = angle.Text.IsValid();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ namespace Sunny.UI
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (LineOption.ToolTip != null)
|
||||
if (LineOption.ToolTip.Visible)
|
||||
{
|
||||
if (sb.ToString().IsNullOrEmpty())
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace Sunny.UI
|
||||
|
||||
public UIAxis YAxis { get; set; } = new UIAxis(UIAxisType.Value);
|
||||
|
||||
public UIBarToolTip ToolTip { get; set; }
|
||||
public UILineToolTip ToolTip { get; set; } = new UILineToolTip();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
@ -215,8 +215,14 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public class UILineToolTip : UIChartToolTip
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class UILineSeries
|
||||
{
|
||||
public int Index { get; set; }
|
||||
public string Name { get; private set; }
|
||||
|
||||
public float Width { get; set; } = 2;
|
||||
|
@ -30,6 +30,15 @@ namespace Sunny.UI
|
||||
public UILegend Legend;
|
||||
}
|
||||
|
||||
public class UIChartToolTip
|
||||
{
|
||||
public bool Visible { get; set; }
|
||||
|
||||
public string Formatter { get; set; }
|
||||
|
||||
public string ValueFormat { get; set; }
|
||||
}
|
||||
|
||||
public class UIScaleLine
|
||||
{
|
||||
public double Value { get; set; }
|
||||
|
@ -243,7 +243,11 @@ namespace Sunny.UI
|
||||
tip.Top = e.Location.Y + 20;
|
||||
}
|
||||
|
||||
if (PieOption.ToolTip.Visible)
|
||||
{
|
||||
if (!tip.Visible) tip.Visible = angle.Text.IsValid();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace Sunny.UI
|
||||
{
|
||||
public List<UIPieSeries> Series = new List<UIPieSeries>();
|
||||
|
||||
public UIPieToolTip ToolTip;
|
||||
public UIPieToolTip ToolTip { get; set; } = new UIPieToolTip();
|
||||
|
||||
public void AddSeries(UIPieSeries series)
|
||||
{
|
||||
@ -54,7 +54,7 @@ namespace Sunny.UI
|
||||
{
|
||||
public List<UIDoughnutSeries> Series = new List<UIDoughnutSeries>();
|
||||
|
||||
public UIPieToolTip ToolTip;
|
||||
public UIPieToolTip ToolTip { get; set; } = new UIPieToolTip();
|
||||
|
||||
public void AddSeries(UIDoughnutSeries series)
|
||||
{
|
||||
@ -75,11 +75,14 @@ namespace Sunny.UI
|
||||
public int SeriesCount => Series.Count;
|
||||
}
|
||||
|
||||
public class UIPieToolTip
|
||||
public class UIPieToolTip : UIChartToolTip
|
||||
{
|
||||
public string Formatter { get; set; } = "{{a}}" + '\n' + "{{b}} : {{c}} ({{d}}%)";
|
||||
|
||||
public string ValueFormat { get; set; } = "F0";
|
||||
public UIPieToolTip()
|
||||
{
|
||||
Formatter = "{{a}}" + '\n' + "{{b}} : {{c}} ({{d}}%)";
|
||||
ValueFormat = "F0";
|
||||
Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public class UIPieSeries : IDisposable
|
||||
|
Loading…
x
Reference in New Issue
Block a user