* UIBarChart, UIPieChart, UIDoughnutChart增加更新数据的方法

This commit is contained in:
Sunny 2021-07-21 11:20:08 +08:00
parent 7e85f8d817
commit 2456e75e06
20 changed files with 438 additions and 9 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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;
}
}

View File

@ -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();
}
}
}

View File

@ -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;
}
}

View File

@ -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();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -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;
}
}

View File

@ -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();
}
}
}

View File

@ -344,6 +344,9 @@
<EmbeddedResource Include="Charts\FBarChartEx.resx">
<DependentUpon>FBarChartEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Charts\FDoughnutChart.resx">
<DependentUpon>FDoughnutChart.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Charts\FLineChart.resx">
<DependentUpon>FLineChart.cs</DependentUpon>
</EmbeddedResource>

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -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);
}
}
/// <summary>
/// 计算刻度
/// 起始值必须小于结束值

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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