diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe
index 14997c7b..becdc2d8 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 dc6f3ec6..ad6d2acd 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 f1497ded..bf6d059a 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 bf925cef..85ac8d0c 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 336dab23..ddc957dd 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 2defc590..ae7d058b 100644
Binary files a/Bin/netcoreapp3.1/SunnyUI.dll and b/Bin/netcoreapp3.1/SunnyUI.dll differ
diff --git a/SunnyUI.Demo/Charts/FBarChart.Designer.cs b/SunnyUI.Demo/Charts/FBarChart.Designer.cs
index 9686a41f..5c76016c 100644
--- a/SunnyUI.Demo/Charts/FBarChart.Designer.cs
+++ b/SunnyUI.Demo/Charts/FBarChart.Designer.cs
@@ -35,6 +35,7 @@ namespace Sunny.UI.Demo
this.uiImageButton1 = new Sunny.UI.UIImageButton();
this.uiLine1 = new Sunny.UI.UILine();
this.BarChart = new Sunny.UI.UIBarChart();
+ this.uiSymbolButton2 = new Sunny.UI.UISymbolButton();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton1)).BeginInit();
@@ -119,11 +120,27 @@ namespace Sunny.UI.Demo
this.BarChart.TabIndex = 29;
this.BarChart.Text = "uiBarChart1";
//
+ // uiSymbolButton2
+ //
+ this.uiSymbolButton2.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.uiSymbolButton2.Enabled = false;
+ this.uiSymbolButton2.Font = new System.Drawing.Font("微软雅黑", 12F);
+ this.uiSymbolButton2.Location = new System.Drawing.Point(454, 503);
+ 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 = 61473;
+ this.uiSymbolButton2.TabIndex = 35;
+ this.uiSymbolButton2.Text = "更新";
+ this.uiSymbolButton2.Click += new System.EventHandler(this.uiSymbolButton2_Click);
+ //
// FBarChart
//
this.AllowShowTitle = true;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(800, 606);
+ this.Controls.Add(this.uiSymbolButton2);
this.Controls.Add(this.uiSymbolButton1);
this.Controls.Add(this.uiImageButton3);
this.Controls.Add(this.uiImageButton2);
@@ -150,5 +167,6 @@ namespace Sunny.UI.Demo
private UIImageButton uiImageButton1;
private UILine uiLine1;
private UIBarChart BarChart;
+ private UISymbolButton uiSymbolButton2;
}
}
\ No newline at end of file
diff --git a/SunnyUI.Demo/Charts/FBarChart.cs b/SunnyUI.Demo/Charts/FBarChart.cs
index 8fea469a..905eaf9e 100644
--- a/SunnyUI.Demo/Charts/FBarChart.cs
+++ b/SunnyUI.Demo/Charts/FBarChart.cs
@@ -1,4 +1,4 @@
-using System.Drawing;
+using System;
namespace Sunny.UI.Demo
{
@@ -63,10 +63,12 @@ namespace Sunny.UI.Demo
option.XAxis.Name = "日期";
option.YAxis.Name = "数值";
- option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Red, Name = "上限", Value = 12 });
- option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Gold, Name = "下限", Value = -20 });
+ //option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Red, Name = "上限", Value = 12 });
+ //option.YAxisScaleLines.Add(new UIScaleLine() { Color = Color.Gold, Name = "下限", Value = -20 });
BarChart.SetOption(option);
+
+ uiSymbolButton2.Enabled = true;
}
private void uiImageButton1_Click(object sender, System.EventArgs e)
@@ -83,5 +85,29 @@ namespace Sunny.UI.Demo
{
BarChart.ChartStyleType = UIChartStyleType.Dark;
}
+
+ private void uiSymbolButton2_Click(object sender, System.EventArgs e)
+ {
+ Random random = new Random(DateTime.Now.Millisecond);
+ BarChart.Update("Bar1", 0, random.Next(10));
+ BarChart.Update("Bar1", 1, random.Next(10));
+ BarChart.Update("Bar1", 2, random.Next(10));
+ BarChart.Update("Bar1", 3, random.Next(10));
+ BarChart.Update("Bar1", 4, random.Next(10));
+ BarChart.Update("Bar1", 5, random.Next(10));
+ BarChart.Update("Bar1", 6, random.Next(10));
+ BarChart.Update("Bar1", 7, random.Next(10));
+
+ BarChart.Update("Bar2", 0, random.Next(10));
+ BarChart.Update("Bar2", 1, random.Next(10));
+ BarChart.Update("Bar2", 2, random.Next(10));
+ BarChart.Update("Bar2", 3, random.Next(10));
+ BarChart.Update("Bar2", 4, random.Next(10));
+ BarChart.Update("Bar2", 5, random.Next(10));
+ BarChart.Update("Bar2", 6, random.Next(10));
+ BarChart.Update("Bar2", 7, random.Next(10));
+
+ BarChart.Refresh();
+ }
}
}
diff --git a/SunnyUI.Demo/Charts/FDoughnutChart.Designer.cs b/SunnyUI.Demo/Charts/FDoughnutChart.Designer.cs
index 95ed7444..7eba56d8 100644
--- a/SunnyUI.Demo/Charts/FDoughnutChart.Designer.cs
+++ b/SunnyUI.Demo/Charts/FDoughnutChart.Designer.cs
@@ -34,6 +34,7 @@
this.uiImageButton2 = new Sunny.UI.UIImageButton();
this.uiImageButton1 = new Sunny.UI.UIImageButton();
this.uiLine1 = new Sunny.UI.UILine();
+ this.uiSymbolButton2 = new Sunny.UI.UISymbolButton();
this.PagePanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton2)).BeginInit();
@@ -42,6 +43,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);
@@ -56,6 +58,7 @@
this.DoughnutChart.Font = new System.Drawing.Font("微软雅黑", 12F);
this.DoughnutChart.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(54)))), ((int)(((byte)(54)))));
this.DoughnutChart.Location = new System.Drawing.Point(30, 48);
+ this.DoughnutChart.MinimumSize = new System.Drawing.Size(1, 1);
this.DoughnutChart.Name = "DoughnutChart";
this.DoughnutChart.Size = new System.Drawing.Size(670, 400);
this.DoughnutChart.TabIndex = 0;
@@ -66,6 +69,7 @@
this.uiSymbolButton1.Cursor = System.Windows.Forms.Cursors.Hand;
this.uiSymbolButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiSymbolButton1.Location = new System.Drawing.Point(348, 466);
+ this.uiSymbolButton1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiSymbolButton1.Name = "uiSymbolButton1";
this.uiSymbolButton1.Padding = new System.Windows.Forms.Padding(28, 0, 0, 0);
this.uiSymbolButton1.Size = new System.Drawing.Size(100, 27);
@@ -77,6 +81,7 @@
// uiImageButton3
//
this.uiImageButton3.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.uiImageButton3.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiImageButton3.Image = global::Sunny.UI.Demo.Properties.Resources.ChartDarkStyle;
this.uiImageButton3.Location = new System.Drawing.Point(242, 466);
this.uiImageButton3.Name = "uiImageButton3";
@@ -90,6 +95,7 @@
// uiImageButton2
//
this.uiImageButton2.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.uiImageButton2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiImageButton2.Image = global::Sunny.UI.Demo.Properties.Resources.ChartPlainStyle;
this.uiImageButton2.Location = new System.Drawing.Point(136, 466);
this.uiImageButton2.Name = "uiImageButton2";
@@ -103,6 +109,7 @@
// uiImageButton1
//
this.uiImageButton1.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.uiImageButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiImageButton1.Image = global::Sunny.UI.Demo.Properties.Resources.ChartDefaultStyle;
this.uiImageButton1.Location = new System.Drawing.Point(30, 466);
this.uiImageButton1.Name = "uiImageButton1";
@@ -124,9 +131,23 @@
this.uiLine1.Text = "UIDoughnutChart";
this.uiLine1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
+ // uiSymbolButton2
+ //
+ this.uiSymbolButton2.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.uiSymbolButton2.Enabled = false;
+ 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 = 61473;
+ this.uiSymbolButton2.TabIndex = 36;
+ this.uiSymbolButton2.Text = "更新";
+ this.uiSymbolButton2.Click += new System.EventHandler(this.uiSymbolButton2_Click);
+ //
// FDoughnutChart
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(800, 558);
this.Name = "FDoughnutChart";
@@ -148,5 +169,6 @@
private UIImageButton uiImageButton2;
private UIImageButton uiImageButton1;
private UILine uiLine1;
+ private UISymbolButton uiSymbolButton2;
}
}
\ No newline at end of file
diff --git a/SunnyUI.Demo/Charts/FDoughnutChart.cs b/SunnyUI.Demo/Charts/FDoughnutChart.cs
index e80f447d..20d3b624 100644
--- a/SunnyUI.Demo/Charts/FDoughnutChart.cs
+++ b/SunnyUI.Demo/Charts/FDoughnutChart.cs
@@ -1,4 +1,6 @@
-namespace Sunny.UI.Demo.Charts
+using System;
+
+namespace Sunny.UI.Demo.Charts
{
public partial class FDoughnutChart : UITitlePage
{
@@ -36,7 +38,7 @@
//设置Series
var series = new UIDoughnutSeries();
- series.Name = "Star count";
+ series.Name = "StarCount";
series.Center = new UICenter(50, 55);
series.Radius.Inner = 40;
series.Radius.Outer = 70;
@@ -53,10 +55,12 @@
series.AddData("2020-05-25", 27);
//增加Series
+ option.Series.Clear();
option.Series.Add(series);
//设置Option
DoughnutChart.SetOption(option);
+ uiSymbolButton2.Enabled = true;
}
private void uiImageButton1_Click(object sender, System.EventArgs e)
@@ -73,5 +77,19 @@
{
DoughnutChart.ChartStyleType = UIChartStyleType.Dark;
}
+
+ private void uiSymbolButton2_Click(object sender, System.EventArgs e)
+ {
+ Random random = new Random(DateTime.Now.Millisecond);
+ DoughnutChart.Update("StarCount", "2020-05-19", random.Next(50));
+ DoughnutChart.Update("StarCount", "2020-05-20", random.Next(50));
+ DoughnutChart.Update("StarCount", "2020-05-21", random.Next(50));
+ DoughnutChart.Update("StarCount", "2020-05-22", random.Next(50));
+ DoughnutChart.Update("StarCount", "2020-05-23", random.Next(50));
+ DoughnutChart.Update("StarCount", "2020-05-24", random.Next(50));
+ DoughnutChart.Update("StarCount", "2020-05-25", random.Next(50));
+
+ DoughnutChart.Refresh();
+ }
}
}
\ No newline at end of file
diff --git a/SunnyUI.Demo/Charts/FDoughnutChart.resx b/SunnyUI.Demo/Charts/FDoughnutChart.resx
new file mode 100644
index 00000000..1af7de15
--- /dev/null
+++ b/SunnyUI.Demo/Charts/FDoughnutChart.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/SunnyUI.Demo/Charts/FPieChart.Designer.cs b/SunnyUI.Demo/Charts/FPieChart.Designer.cs
index fc844382..8d329407 100644
--- a/SunnyUI.Demo/Charts/FPieChart.Designer.cs
+++ b/SunnyUI.Demo/Charts/FPieChart.Designer.cs
@@ -34,6 +34,7 @@
this.uiImageButton3 = new Sunny.UI.UIImageButton();
this.uiImageButton2 = new Sunny.UI.UIImageButton();
this.uiImageButton1 = new Sunny.UI.UIImageButton();
+ this.uiSymbolButton2 = new Sunny.UI.UISymbolButton();
this.PagePanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uiImageButton2)).BeginInit();
@@ -42,6 +43,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);
@@ -132,9 +134,23 @@
this.uiImageButton1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.uiImageButton1.Click += new System.EventHandler(this.uiImageButton1_Click);
//
+ // uiSymbolButton2
+ //
+ this.uiSymbolButton2.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.uiSymbolButton2.Enabled = false;
+ 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 = 61473;
+ this.uiSymbolButton2.TabIndex = 36;
+ this.uiSymbolButton2.Text = "更新";
+ this.uiSymbolButton2.Click += new System.EventHandler(this.uiSymbolButton2_Click);
+ //
// FPieChart
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(828, 552);
this.Name = "FPieChart";
@@ -155,5 +171,6 @@
private UIImageButton uiImageButton3;
private UIImageButton uiImageButton2;
private UISymbolButton uiSymbolButton1;
+ private UISymbolButton uiSymbolButton2;
}
}
\ No newline at end of file
diff --git a/SunnyUI.Demo/Charts/FPieChart.cs b/SunnyUI.Demo/Charts/FPieChart.cs
index 93b5d661..82ecaab7 100644
--- a/SunnyUI.Demo/Charts/FPieChart.cs
+++ b/SunnyUI.Demo/Charts/FPieChart.cs
@@ -1,4 +1,6 @@
-namespace Sunny.UI.Demo.Controls
+using System;
+
+namespace Sunny.UI.Demo.Controls
{
public partial class FPieChart : UITitlePage
{
@@ -51,7 +53,7 @@
//设置Series
var series = new UIPieSeries();
- series.Name = "Star count";
+ series.Name = "StarCount";
series.Center = new UICenter(50, 55);
series.Radius = 70;
series.Label.Show = true;
@@ -66,10 +68,27 @@
series.AddData("2020-05-25", 27);
//增加Series
+ option.Series.Clear();
option.Series.Add(series);
//设置Option
PieChart.SetOption(option);
+
+ uiSymbolButton2.Enabled = true;
+ }
+
+ private void uiSymbolButton2_Click(object sender, System.EventArgs e)
+ {
+ Random random = new Random(DateTime.Now.Millisecond);
+ PieChart.Update("StarCount", "2020-05-19", random.Next(50));
+ PieChart.Update("StarCount", "2020-05-20", random.Next(50));
+ PieChart.Update("StarCount", "2020-05-21", random.Next(50));
+ PieChart.Update("StarCount", "2020-05-22", random.Next(50));
+ PieChart.Update("StarCount", "2020-05-23", random.Next(50));
+ PieChart.Update("StarCount", "2020-05-24", random.Next(50));
+ PieChart.Update("StarCount", "2020-05-25", random.Next(50));
+
+ PieChart.Refresh();
}
}
}
\ No newline at end of file
diff --git a/SunnyUI.Demo/SunnyUI.Demo.csproj b/SunnyUI.Demo/SunnyUI.Demo.csproj
index 454e6478..18da7b49 100644
--- a/SunnyUI.Demo/SunnyUI.Demo.csproj
+++ b/SunnyUI.Demo/SunnyUI.Demo.csproj
@@ -344,6 +344,9 @@
FBarChartEx.cs
+
+ FDoughnutChart.cs
+
FLineChart.cs
diff --git a/SunnyUI.Net5.Demo/Charts/FBarChart.resx b/SunnyUI.Net5.Demo/Charts/FBarChart.resx
new file mode 100644
index 00000000..f298a7be
--- /dev/null
+++ b/SunnyUI.Net5.Demo/Charts/FBarChart.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/SunnyUI/Charts/UIBarChart.cs b/SunnyUI/Charts/UIBarChart.cs
index 0c3fe1b6..8cce26c2 100644
--- a/SunnyUI/Charts/UIBarChart.cs
+++ b/SunnyUI/Charts/UIBarChart.cs
@@ -42,6 +42,26 @@ namespace Sunny.UI
CalcData();
}
+ public override void Refresh()
+ {
+ base.Refresh();
+ if (Option != null)
+ {
+ SetOption(Option);
+ }
+
+ CalcData();
+ }
+
+ public void Update(string seriesName, int index, double value)
+ {
+ var series = Option[seriesName];
+ if (series != null)
+ {
+ series.Update(index, value);
+ }
+ }
+
///
/// 计算刻度
/// 起始值必须小于结束值
diff --git a/SunnyUI/Charts/UIBarChartOption.cs b/SunnyUI/Charts/UIBarChartOption.cs
index cc622e52..c702e079 100644
--- a/SunnyUI/Charts/UIBarChartOption.cs
+++ b/SunnyUI/Charts/UIBarChartOption.cs
@@ -71,6 +71,19 @@ namespace Sunny.UI
}
public int SeriesCount => Series.Count;
+
+ public UIBarSeries this[string seriesName]
+ {
+ get
+ {
+ foreach (var item in Series)
+ {
+ if (item.Name == seriesName) return item;
+ }
+
+ return null;
+ }
+ }
}
public class UIBarToolTip : UIChartToolTip
@@ -283,6 +296,15 @@ namespace Sunny.UI
Colors.Clear();
}
+ public void Update(int index, double value)
+ {
+ if (Data.Count == 0) return;
+ if (index >= 0 && index < Data.Count)
+ {
+ Data[index] = value;
+ }
+ }
+
public delegate Color OnDataColorChangeEventHandler(double data);
public event OnDataColorChangeEventHandler DataColorChange;
diff --git a/SunnyUI/Charts/UIDoughnutChart.cs b/SunnyUI/Charts/UIDoughnutChart.cs
index e90d63c6..8f58776e 100644
--- a/SunnyUI/Charts/UIDoughnutChart.cs
+++ b/SunnyUI/Charts/UIDoughnutChart.cs
@@ -55,12 +55,32 @@ namespace Sunny.UI
emptyOption = option;
}
+ public void Update(string seriesName, string name, double value)
+ {
+ var series = Option[seriesName];
+ if (series != null)
+ {
+ series.Update(name, value);
+ }
+ }
+
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
CalcData();
}
+ public override void Refresh()
+ {
+ base.Refresh();
+ if (Option != null)
+ {
+ SetOption(Option);
+ }
+
+ CalcData();
+ }
+
protected override void DrawOption(Graphics g)
{
if (Option == null) return;
diff --git a/SunnyUI/Charts/UIPieChart.cs b/SunnyUI/Charts/UIPieChart.cs
index 61863cde..88ac9709 100644
--- a/SunnyUI/Charts/UIPieChart.cs
+++ b/SunnyUI/Charts/UIPieChart.cs
@@ -54,12 +54,32 @@ namespace Sunny.UI
emptyOption = option;
}
+ public void Update(string seriesName, string name, double value)
+ {
+ var series = Option[seriesName];
+ if (series != null)
+ {
+ series.Update(name, value);
+ }
+ }
+
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
CalcData();
}
+ public override void Refresh()
+ {
+ base.Refresh();
+ if (Option != null)
+ {
+ SetOption(Option);
+ }
+
+ CalcData();
+ }
+
protected override void DrawOption(Graphics g)
{
if (Option == null) return;
diff --git a/SunnyUI/Charts/UIPieChartOption.cs b/SunnyUI/Charts/UIPieChartOption.cs
index 6ef8f2ea..6fa6e8fd 100644
--- a/SunnyUI/Charts/UIPieChartOption.cs
+++ b/SunnyUI/Charts/UIPieChartOption.cs
@@ -48,6 +48,19 @@ namespace Sunny.UI
}
public int SeriesCount => Series.Count;
+
+ public UIPieSeries this[string seriesName]
+ {
+ get
+ {
+ foreach (var item in Series)
+ {
+ if (item.Name == seriesName) return item;
+ }
+
+ return null;
+ }
+ }
}
public class UIDoughnutOption : UIOption, IDisposable
@@ -73,6 +86,19 @@ namespace Sunny.UI
}
public int SeriesCount => Series.Count;
+
+ public UIDoughnutSeries this[string seriesName]
+ {
+ get
+ {
+ foreach (var item in Series)
+ {
+ if (item.Name == seriesName) return item;
+ }
+
+ return null;
+ }
+ }
}
public class UIPieToolTip : UIChartToolTip
@@ -125,6 +151,15 @@ namespace Sunny.UI
{
Data.Clear();
}
+
+ public void Update(string name, double value)
+ {
+ foreach (var item in Data)
+ {
+ if (item.Name == name)
+ item.Value = value;
+ }
+ }
}
public class RadiusInOut
@@ -168,6 +203,15 @@ namespace Sunny.UI
{
Data.Clear();
}
+
+ public void Update(string name, double value)
+ {
+ foreach (var item in Data)
+ {
+ if (item.Name == name)
+ item.Value = value;
+ }
+ }
}
public class UIPieSeriesData