diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 8aa370ae..999bb33d 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/SunnyUI/Charts/UILineChart.cs b/SunnyUI/Charts/UILineChart.cs index 0b83d4b0..f384478c 100644 --- a/SunnyUI/Charts/UILineChart.cs +++ b/SunnyUI/Charts/UILineChart.cs @@ -31,7 +31,7 @@ using System.Windows.Forms; namespace Sunny.UI { [ToolboxItem(true)] - public sealed class UILineChart : UIChart + public class UILineChart : UIChart { private bool NeedDraw; @@ -41,8 +41,8 @@ namespace Sunny.UI CalcData(); } - private Point DrawOrigin; - private Size DrawSize; + protected Point DrawOrigin; + protected Size DrawSize; protected override void CalcData() { @@ -67,8 +67,8 @@ namespace Sunny.UI NeedDraw = true; } - private UIScale XScale; - private UIScale YScale; + protected UIScale XScale; + protected UIScale YScale; private double[] YLabels; private double[] XLabels; @@ -160,6 +160,12 @@ namespace Sunny.UI DrawSeries(g); // if (BarOption.ToolTip != null && BarOption.ToolTip.AxisPointer.Type == UIAxisPointerType.Line) DrawToolTip(g); DrawLegend(g, Option.Legend); + DrawOther(g); + } + + protected virtual void DrawOther(Graphics g) + { + } private void DrawAxis(Graphics g) diff --git a/SunnyUI/Charts/UIOption.cs b/SunnyUI/Charts/UIOption.cs index 2b758d3e..0b03edb1 100644 --- a/SunnyUI/Charts/UIOption.cs +++ b/SunnyUI/Charts/UIOption.cs @@ -47,6 +47,8 @@ namespace Sunny.UI public UILeftAlignment Left { get; set; } = UILeftAlignment.Left; public float Size { get; set; } = 1.0f; + + public object Tag { get; set; } } public class UILegend diff --git a/SunnyUI/Charts/UIScale.cs b/SunnyUI/Charts/UIScale.cs index 30d2e29b..73a05104 100644 --- a/SunnyUI/Charts/UIScale.cs +++ b/SunnyUI/Charts/UIScale.cs @@ -56,11 +56,21 @@ namespace Sunny.UI return origin + (float)((value - _min) * 1.0f * width / (_max - _min)); } + public double CalcXPos(double value, int origin, int width) + { + return (float)(_min + (value - origin) * (_max - _min) * 1.0f / width); + } + public float CalcYPixel(double value, int origin, int height) { return origin - (float)((value - _min) * 1.0f * height / (_max - _min)); } + public double CalcYPos(double value, int origin, int height) + { + return (float)(_min + (origin - value) * (_max - _min) * 1.0f / height); + } + public float[] CalcXPixels(double[] labels, int origin, int width) { if (labels == null) return null;