diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe
index becdc2d8..d74bfdaa 100644
Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ
diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll
index ad6d2acd..c7c0d8c5 100644
Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ
diff --git a/Bin/net45/SunnyUI.dll b/Bin/net45/SunnyUI.dll
index bf6d059a..72d1404a 100644
Binary files a/Bin/net45/SunnyUI.dll and b/Bin/net45/SunnyUI.dll differ
diff --git a/Bin/net5.0-windows/SunnyUI.dll b/Bin/net5.0-windows/SunnyUI.dll
index 85ac8d0c..6d965ca1 100644
Binary files a/Bin/net5.0-windows/SunnyUI.dll and b/Bin/net5.0-windows/SunnyUI.dll differ
diff --git a/Bin/net5.0-windows/ref/SunnyUI.dll b/Bin/net5.0-windows/ref/SunnyUI.dll
index ddc957dd..fcc01dfd 100644
Binary files a/Bin/net5.0-windows/ref/SunnyUI.dll and b/Bin/net5.0-windows/ref/SunnyUI.dll differ
diff --git a/Bin/netcoreapp3.1/SunnyUI.dll b/Bin/netcoreapp3.1/SunnyUI.dll
index ae7d058b..bc99191e 100644
Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ
diff --git a/SunnyUI.Demo/Charts/FLineChart.Designer.cs b/SunnyUI.Demo/Charts/FLineChart.Designer.cs
index 0ec116ee..3b36cdd6 100644
--- a/SunnyUI.Demo/Charts/FLineChart.Designer.cs
+++ b/SunnyUI.Demo/Charts/FLineChart.Designer.cs
@@ -28,12 +28,15 @@
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
this.uiSymbolButton1 = new Sunny.UI.UISymbolButton();
this.uiImageButton3 = new Sunny.UI.UIImageButton();
this.uiImageButton2 = new Sunny.UI.UIImageButton();
this.uiImageButton1 = new Sunny.UI.UIImageButton();
this.uiLine1 = new Sunny.UI.UILine();
this.LineChart = new Sunny.UI.UILineChart();
+ this.uiSymbolButton2 = new Sunny.UI.UISymbolButton();
+ this.timer1 = new System.Windows.Forms.Timer(this.components);
this.PagePanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton2)).BeginInit();
@@ -42,6 +45,7 @@
//
// PagePanel
//
+ this.PagePanel.Controls.Add(this.uiSymbolButton2);
this.PagePanel.Controls.Add(this.uiSymbolButton1);
this.PagePanel.Controls.Add(this.uiImageButton3);
this.PagePanel.Controls.Add(this.uiImageButton2);
@@ -130,9 +134,26 @@
this.LineChart.Text = "uiLineChart1";
this.LineChart.PointValue += new Sunny.UI.UILineChart.OnPointValue(this.LineChart_PointValue);
//
+ // uiSymbolButton2
+ //
+ this.uiSymbolButton2.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.uiSymbolButton2.Font = new System.Drawing.Font("微软雅黑", 12F);
+ this.uiSymbolButton2.Location = new System.Drawing.Point(454, 466);
+ this.uiSymbolButton2.MinimumSize = new System.Drawing.Size(1, 1);
+ this.uiSymbolButton2.Name = "uiSymbolButton2";
+ this.uiSymbolButton2.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
+ this.uiSymbolButton2.Size = new System.Drawing.Size(100, 27);
+ this.uiSymbolButton2.Symbol = 61463;
+ this.uiSymbolButton2.TabIndex = 36;
+ this.uiSymbolButton2.Text = "实时";
+ this.uiSymbolButton2.Click += new System.EventHandler(this.uiSymbolButton2_Click);
+ //
+ // timer1
+ //
+ this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
+ //
// FLineChart
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(800, 574);
this.Name = "FLineChart";
@@ -154,5 +175,7 @@
private UIImageButton uiImageButton1;
private UILine uiLine1;
private UILineChart LineChart;
+ private UISymbolButton uiSymbolButton2;
+ private System.Windows.Forms.Timer timer1;
}
}
\ No newline at end of file
diff --git a/SunnyUI.Demo/Charts/FLineChart.cs b/SunnyUI.Demo/Charts/FLineChart.cs
index fcfcca0e..f95c98e7 100644
--- a/SunnyUI.Demo/Charts/FLineChart.cs
+++ b/SunnyUI.Demo/Charts/FLineChart.cs
@@ -13,6 +13,10 @@ namespace Sunny.UI.Demo.Charts
private void uiSymbolButton1_Click(object sender, EventArgs e)
{
+ timer1.Stop();
+
+ DateTime dt = new DateTime(2020, 10, 4);
+
UILineOption option = new UILineOption();
option.ToolTip.Visible = true;
option.Title = new UITitle();
@@ -22,7 +26,6 @@ namespace Sunny.UI.Demo.Charts
option.XAxisType = UIAxisType.DateTime;
var series = option.AddSeries(new UILineSeries("Line1"));
- DateTime dt = new DateTime(2020, 10, 4);
series.Add(dt.AddHours(0), 1.2);
series.Add(dt.AddHours(1), 2.2);
series.Add(dt.AddHours(2), 3.2);
@@ -55,8 +58,10 @@ namespace Sunny.UI.Demo.Charts
option.XAxis.Name = "日期";
option.YAxis.Name = "数值";
- option.XAxis.AxisLabel.DateTimeFormat = DateTimeEx.DateTimeFormat;
+ option.XAxis.AxisLabel.DateTimeFormat = "yyyy-MM-dd HH:mm";
+ option.XAxis.AxisLabel.AutoFormat = false;
option.YAxis.AxisLabel.DecimalCount = 1;
+ option.YAxis.AxisLabel.AutoFormat = false;
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)) });
@@ -89,5 +94,43 @@ namespace Sunny.UI.Demo.Charts
Console.WriteLine(sb.ToString());
}
+
+ private void uiSymbolButton2_Click(object sender, EventArgs e)
+ {
+ index = 0;
+ UILineOption option = new UILineOption();
+ option.ToolTip.Visible = true;
+ option.Title = new UITitle();
+ option.Title.Text = "SunnyUI";
+ option.Title.SubText = "LineChart";
+ var series = option.AddSeries(new UILineSeries("Line1"));
+ series.Smooth = true;
+
+ option.XAxis.AxisLabel.DecimalCount = 1;
+ option.XAxis.AxisLabel.AutoFormat = false;
+ option.YAxis.AxisLabel.DecimalCount = 1;
+ option.YAxis.AxisLabel.AutoFormat = false;
+ LineChart.SetOption(option);
+ timer1.Start();
+ }
+
+ int index = 0;
+ Random random = new Random();
+
+ private void timer1_Tick(object sender, EventArgs e)
+ {
+ LineChart.Option.AddData("Line1", index, random.NextDouble() * 10);
+ index++;
+
+ if (index > 50)
+ {
+ LineChart.Option.XAxis.Max = index + 20;
+ LineChart.Option.XAxis.MaxAuto = false;
+ LineChart.Option.XAxis.Min = index - 50;
+ LineChart.Option.XAxis.MinAuto = false;
+ }
+
+ LineChart.Refresh();
+ }
}
}
diff --git a/SunnyUI.Demo/Charts/FLineChart.resx b/SunnyUI.Demo/Charts/FLineChart.resx
index 1af7de15..1f666f26 100644
--- a/SunnyUI.Demo/Charts/FLineChart.resx
+++ b/SunnyUI.Demo/Charts/FLineChart.resx
@@ -117,4 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
\ No newline at end of file
diff --git a/SunnyUI.Demo/Controls/FDataGridView.cs b/SunnyUI.Demo/Controls/FDataGridView.cs
index c5853dbc..32f9f109 100644
--- a/SunnyUI.Demo/Controls/FDataGridView.cs
+++ b/SunnyUI.Demo/Controls/FDataGridView.cs
@@ -10,10 +10,10 @@ namespace Sunny.UI.Demo
{
InitializeComponent();
- uiDataGridView1.AddColumn("Column1", "Column1").SetFixedMode(150);
- uiDataGridView1.AddColumn("Column2", "Column2").SetFixedMode(150);
- uiDataGridView1.AddColumn("Column3", "Column3").SetFixedMode(150);
- uiDataGridView1.AddColumn("Column4", "Column4").SetFixedMode(150);
+ uiDataGridView1.AddColumn("Column1", "Column1");
+ uiDataGridView1.AddColumn("Column2", "Column2");
+ uiDataGridView1.AddColumn("Column3", "Column3");
+ uiDataGridView1.AddColumn("Column4", "Column4");
uiDataGridView1.ReadOnly = true;
for (int i = 0; i < 3610; i++)
diff --git a/SunnyUI.Demo/FMain.cs b/SunnyUI.Demo/FMain.cs
index 4836c62b..4631245a 100644
--- a/SunnyUI.Demo/FMain.cs
+++ b/SunnyUI.Demo/FMain.cs
@@ -57,7 +57,7 @@ namespace Sunny.UI.Demo
Aside.CreateChildNode(parent, AddPage(new FPieChart()));
Aside.CreateChildNode(parent, AddPage(new FDoughnutChart()));
Aside.CreateChildNode(parent, AddPage(new FBarChart()));
- Aside.CreateChildNode(parent, AddPage(new FBarChartEx()));
+ //Aside.CreateChildNode(parent, AddPage(new FBarChartEx()));
Aside.CreateChildNode(parent, AddPage(new FLineChart()));
AddPage(new FColorful());
diff --git a/SunnyUI/Charts/UIBarChartEx.cs b/SunnyUI/Charts/UIBarChartEx.cs
index faa33798..b04425f3 100644
--- a/SunnyUI/Charts/UIBarChartEx.cs
+++ b/SunnyUI/Charts/UIBarChartEx.cs
@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
@@ -28,6 +29,7 @@ using System.Windows.Forms;
namespace Sunny.UI
{
+ [ToolboxItem(false)]
public sealed class UIBarChartEx : UIBarChart
{
protected override void CalcData()
diff --git a/SunnyUI/Charts/UILineChart.cs b/SunnyUI/Charts/UILineChart.cs
index 782e1b11..51458bad 100644
--- a/SunnyUI/Charts/UILineChart.cs
+++ b/SunnyUI/Charts/UILineChart.cs
@@ -68,6 +68,17 @@ namespace Sunny.UI
NeedDraw = true;
}
+ public override void Refresh()
+ {
+ base.Refresh();
+ if (Option != null)
+ {
+ SetOption(Option);
+ }
+
+ CalcData();
+ }
+
protected UIScale XScale;
protected UIScale YScale;
private double[] YLabels;