* UIBarChart:绘制水平线增加宽度

This commit is contained in:
Sunny 2020-07-19 20:33:13 +08:00
parent 3c742b2b67
commit e1e5c3a31d
6 changed files with 10 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -445,7 +445,11 @@ namespace Sunny.UI
double ymax = YAxisEnd * YAxisInterval; double ymax = YAxisEnd * YAxisInterval;
float pos = (float)((line.Value - ymin) * (Height - BarOption.Grid.Top - BarOption.Grid.Bottom) / (ymax - ymin)); float pos = (float)((line.Value - ymin) * (Height - BarOption.Grid.Top - BarOption.Grid.Bottom) / (ymax - ymin));
pos = (Height - BarOption.Grid.Bottom - pos); pos = (Height - BarOption.Grid.Bottom - pos);
g.DrawLine(line.Color, DrawOrigin.X, pos, Width - BarOption.Grid.Right, pos); using (Pen pn = new Pen(line.Color,line.Size))
{
g.DrawLine(pn, DrawOrigin.X, pos, Width - BarOption.Grid.Right, pos);
}
SizeF sf = g.MeasureString(line.Name, SubFont); SizeF sf = g.MeasureString(line.Name, SubFont);
if (line.Left == UILeftAlignment.Left) if (line.Left == UILeftAlignment.Left)

View File

@ -36,7 +36,9 @@ namespace Sunny.UI
public double Value { get; set; } public double Value { get; set; }
public string Name { get; set; } public string Name { get; set; }
public Color Color { get; set; } public Color Color { get; set; }
public UILeftAlignment Left { get; set; } public UILeftAlignment Left { get; set; } = UILeftAlignment.Left;
public float Size { get; set; } = 1.0f;
} }
public class UILegend public class UILegend

View File

@ -617,6 +617,8 @@ namespace Sunny.UI
{ {
base.OnDrawNode(e); base.OnDrawNode(e);
if (e.Node==null) return;
if (BorderStyle == BorderStyle.Fixed3D) BorderStyle = BorderStyle.FixedSingle; if (BorderStyle == BorderStyle.Fixed3D) BorderStyle = BorderStyle.FixedSingle;
if (e.Node == null || e.Node.Bounds.Width <= 0 && e.Node.Bounds.Height <= 0 && e.Node.Bounds.X <= 0 && if (e.Node == null || e.Node.Bounds.Width <= 0 && e.Node.Bounds.Height <= 0 && e.Node.Bounds.X <= 0 &&