SunnyUI/SunnyUI.Demo/Charts/FDoughnutChart.cs
Sunny 6d93656a92 2020.06.26
+ UIDoughnutChart:增加控件:环状图
2020-06-26 15:13:36 +08:00

77 lines
2.5 KiB
C#

namespace Sunny.UI.Demo.Charts
{
public partial class FDoughnutChart : UITitlePage
{
public FDoughnutChart()
{
InitializeComponent();
}
private void uiSymbolButton1_Click(object sender, System.EventArgs e)
{
var option = new UIDoughnutOption();
//设置Title
option.Title = new UITitle();
option.Title.Text = "SunnyUI";
option.Title.SubText = "Star";
option.Title.Left = UILeftAlignment.Center;
//设置ToolTip
option.ToolTip = new UIPieToolTip();
//设置Legend
option.Legend = new UILegend();
option.Legend.Orient = UIOrient.Vertical;
option.Legend.Top = UITopAlignment.Top;
option.Legend.Left = UILeftAlignment.Left;
option.Legend.AddData("2020-05-19");
option.Legend.AddData("2020-05-20");
option.Legend.AddData("2020-05-21");
option.Legend.AddData("2020-05-22");
option.Legend.AddData("2020-05-23");
option.Legend.AddData("2020-05-24");
option.Legend.AddData("2020-05-25");
//设置Series
var series = new UIDoughnutSeries();
series.Name = "Star count";
series.Center = new UICenter(50, 55);
series.Radius.Inner = 40;
series.Radius.Outer = 70;
series.Label.Show = true;
series.Label.Position = UIPieSeriesLabelPosition.Center;
//增加数据
series.AddData("2020-05-19", 38);
series.AddData("2020-05-20", 21);
series.AddData("2020-05-21", 11);
series.AddData("2020-05-22", 52);
series.AddData("2020-05-23", 23);
series.AddData("2020-05-24", 26);
series.AddData("2020-05-25", 27);
//增加Series
option.Series.Add(series);
//设置Option
DoughnutChart.SetOption(option);
}
private void uiImageButton1_Click(object sender, System.EventArgs e)
{
DoughnutChart.ChartStyleType = UIChartStyleType.Default;
}
private void uiImageButton2_Click(object sender, System.EventArgs e)
{
DoughnutChart.ChartStyleType = UIChartStyleType.Plain;
}
private void uiImageButton3_Click(object sender, System.EventArgs e)
{
DoughnutChart.ChartStyleType = UIChartStyleType.Dark;
}
}
}