* UILineChart:可重载,增加一些函数
This commit is contained in:
parent
c4e4257128
commit
f90a994969
BIN
Bin/SunnyUI.dll
BIN
Bin/SunnyUI.dll
Binary file not shown.
@ -31,7 +31,7 @@ using System.Windows.Forms;
|
|||||||
namespace Sunny.UI
|
namespace Sunny.UI
|
||||||
{
|
{
|
||||||
[ToolboxItem(true)]
|
[ToolboxItem(true)]
|
||||||
public sealed class UILineChart : UIChart
|
public class UILineChart : UIChart
|
||||||
{
|
{
|
||||||
private bool NeedDraw;
|
private bool NeedDraw;
|
||||||
|
|
||||||
@ -41,8 +41,8 @@ namespace Sunny.UI
|
|||||||
CalcData();
|
CalcData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Point DrawOrigin;
|
protected Point DrawOrigin;
|
||||||
private Size DrawSize;
|
protected Size DrawSize;
|
||||||
|
|
||||||
protected override void CalcData()
|
protected override void CalcData()
|
||||||
{
|
{
|
||||||
@ -67,8 +67,8 @@ namespace Sunny.UI
|
|||||||
NeedDraw = true;
|
NeedDraw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private UIScale XScale;
|
protected UIScale XScale;
|
||||||
private UIScale YScale;
|
protected UIScale YScale;
|
||||||
private double[] YLabels;
|
private double[] YLabels;
|
||||||
private double[] XLabels;
|
private double[] XLabels;
|
||||||
|
|
||||||
@ -160,6 +160,12 @@ namespace Sunny.UI
|
|||||||
DrawSeries(g);
|
DrawSeries(g);
|
||||||
// if (BarOption.ToolTip != null && BarOption.ToolTip.AxisPointer.Type == UIAxisPointerType.Line) DrawToolTip(g);
|
// if (BarOption.ToolTip != null && BarOption.ToolTip.AxisPointer.Type == UIAxisPointerType.Line) DrawToolTip(g);
|
||||||
DrawLegend(g, Option.Legend);
|
DrawLegend(g, Option.Legend);
|
||||||
|
DrawOther(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void DrawOther(Graphics g)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawAxis(Graphics g)
|
private void DrawAxis(Graphics g)
|
||||||
|
@ -47,6 +47,8 @@ namespace Sunny.UI
|
|||||||
public UILeftAlignment Left { get; set; } = UILeftAlignment.Left;
|
public UILeftAlignment Left { get; set; } = UILeftAlignment.Left;
|
||||||
|
|
||||||
public float Size { get; set; } = 1.0f;
|
public float Size { get; set; } = 1.0f;
|
||||||
|
|
||||||
|
public object Tag { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UILegend
|
public class UILegend
|
||||||
|
@ -56,11 +56,21 @@ namespace Sunny.UI
|
|||||||
return origin + (float)((value - _min) * 1.0f * width / (_max - _min));
|
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)
|
public float CalcYPixel(double value, int origin, int height)
|
||||||
{
|
{
|
||||||
return origin - (float)((value - _min) * 1.0f * height / (_max - _min));
|
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)
|
public float[] CalcXPixels(double[] labels, int origin, int width)
|
||||||
{
|
{
|
||||||
if (labels == null) return null;
|
if (labels == null) return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user