* UILineChart:增加X轴竖线

This commit is contained in:
Sunny 2020-12-07 21:10:28 +08:00
parent cc0df55012
commit 64c9f6aeb4
7 changed files with 30 additions and 3 deletions

Binary file not shown.

Binary file not shown.

View File

@ -57,6 +57,9 @@ namespace Sunny.UI.Demo.Charts
option.YAxis.Name = "数值";
option.XAxis.AxisLabel.DateTimeFormat = DateTimeEx.DateTimeFormat;
option.XAxisScaleLines.Add(new UIScaleLine() { Color = Color.Red, Name = dt.AddHours(3).DateTimeString(), Value = new DateTimeInt64(dt.AddHours(3)) });
option.XAxisScaleLines.Add(new UIScaleLine() { Color = Color.Red, Name = dt.AddHours(6).DateTimeString(), Value = new DateTimeInt64(dt.AddHours(6)) });
LineChart.SetOption(option);
}

View File

@ -105,7 +105,6 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1024, 720);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximumSize = new System.Drawing.Size(1366, 728);
this.MinimumSize = new System.Drawing.Size(1024, 720);
this.Name = "FMain";
this.Padding = new System.Windows.Forms.Padding(2, 35, 2, 2);
@ -113,6 +112,7 @@
this.ShowRadius = false;
this.ShowShadow = true;
this.Text = "SunnyUI.Net";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Selecting += new Sunny.UI.UIMainFrame.OnSelecting(this.FMain_Selecting);
this.Header.ResumeLayout(false);
this.ResumeLayout(false);

View File

@ -444,6 +444,29 @@ namespace Sunny.UI
if (line.Left == UILeftAlignment.Right)
g.DrawString(line.Name, SubFont, line.Color, Width - sf.Width - 4 - Option.Grid.Right, pos - 2 - sf.Height);
}
int idx = 0;
foreach (var line in Option.XAxisScaleLines)
{
float pos = XScale.CalcXPixel(line.Value, DrawOrigin.X, DrawSize.Width);
using (Pen pn = new Pen(line.Color, line.Size))
{
g.DrawLine(pn, pos, DrawOrigin.Y, pos, Option.Grid.Top);
}
SizeF sf = g.MeasureString(line.Name, SubFont);
float x = pos - sf.Width - 4;
if (x < Option.Grid.Left) x = pos + 4;
float y = Option.Grid.Top + 4 + sf.Height * idx;
if (y > Height - Option.Grid.Bottom)
{
idx = 0;
y = Option.Grid.Top + 4 + sf.Height * idx;
}
idx++;
g.DrawString(line.Name, SubFont, line.Color, x, y);
}
}
private readonly List<UILineSelectPoint> selectPoints = new List<UILineSelectPoint>();

View File

@ -239,7 +239,7 @@ namespace Sunny.UI
/// <summary>
/// 是否以全屏模式进入最大化
/// </summary>
[Description("是否以全屏模式进入最大化"), Category("WindowStyle"), DefaultValue(false)]
[Description("是否以全屏模式进入最大化"), Category("WindowStyle")]
public bool ShowFullScreen
{
get => showFullScreen;

View File

@ -38,7 +38,8 @@ namespace Sunny.UI
/// <returns>结果</returns>
public static string CurrentDir()
{
return Environment.CurrentDirectory.DealPath();
//return Environment.CurrentDirectory.DealPath();
return AppDomain.CurrentDomain.BaseDirectory.DealPath();
}
/// <summary>