|
@@ -1,12 +1,14 @@
|
|
using AntDesign;
|
|
using AntDesign;
|
|
-using AntDesign.Charts;
|
|
|
|
|
|
+
|
|
|
|
+using Blazor.ECharts.Options;
|
|
|
|
+using Blazor.ECharts.Options.Enum;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
-using System.Linq;
|
|
|
|
using System.Text.Json;
|
|
using System.Text.Json;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
using wispro.sp.web.Services;
|
|
using wispro.sp.web.Services;
|
|
|
|
+using P = Blazor.ECharts.Options.Series.Pie;
|
|
|
|
|
|
namespace wispro.sp.web.Pages.Report
|
|
namespace wispro.sp.web.Pages.Report
|
|
{
|
|
{
|
|
@@ -15,6 +17,7 @@ namespace wispro.sp.web.Pages.Report
|
|
private int iType = 1;
|
|
private int iType = 1;
|
|
private DateTime? start = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
|
|
private DateTime? start = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
|
|
private DateTime? end = DateTime.Now;
|
|
private DateTime? end = DateTime.Now;
|
|
|
|
+ Blazor.ECharts.Components.EPie pieChart;
|
|
|
|
|
|
internal class TJType
|
|
internal class TJType
|
|
{
|
|
{
|
|
@@ -29,45 +32,9 @@ namespace wispro.sp.web.Pages.Report
|
|
new TJType { value = 2, Name = "部门申诉统计" },
|
|
new TJType { value = 2, Name = "部门申诉统计" },
|
|
//new TJType { value = 3, Name = "申诉人每月申诉统计" },
|
|
//new TJType { value = 3, Name = "申诉人每月申诉统计" },
|
|
};
|
|
};
|
|
-
|
|
|
|
- private AntDesign.Charts.IChartComponent chart;
|
|
|
|
- private PieConfig config4 = new PieConfig
|
|
|
|
- {
|
|
|
|
- ForceFit = true,
|
|
|
|
- Title = new AntDesign.Charts.Title
|
|
|
|
- {
|
|
|
|
- Visible = true,
|
|
|
|
- Text = "初始化标题",
|
|
|
|
- AlignTo = "middle",
|
|
|
|
- Style= new TextStyle()
|
|
|
|
- {
|
|
|
|
- FontSize=20,
|
|
|
|
- Stroke="#2a3b4c",
|
|
|
|
- Fill = "#AABBDD",
|
|
|
|
- Opacity= 10
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- Description = new Description
|
|
|
|
- {
|
|
|
|
- Visible = false,
|
|
|
|
- Text = "When the type of the pie chart label is set to spider, the labels are divided into two groups, and they are displayed in alignment by pulling lines on both sides of the chart. Generally speaking, the labels of the spider layout are less likely to block each other."
|
|
|
|
- },
|
|
|
|
- Radius = 0.8,
|
|
|
|
- InnerRadius =0.5,
|
|
|
|
- AngleField = "value",
|
|
|
|
- ColorField = "type",
|
|
|
|
- Label = new PieLabelConfig
|
|
|
|
- {
|
|
|
|
- Visible = true,
|
|
|
|
- Type = "spider",//"inner",//"outer"//,
|
|
|
|
- //Formatter= "() => $'{(percent * 100).toFixed(0)}%'",
|
|
|
|
- },
|
|
|
|
- Legend= new Legend
|
|
|
|
- {
|
|
|
|
- Visible=false,
|
|
|
|
- Position= "bottom",
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
|
|
+
|
|
|
|
+ private EChartsOption<P.Pie> Option1;
|
|
|
|
+
|
|
|
|
|
|
share.ChartDatas Datas=new share.ChartDatas() {
|
|
share.ChartDatas Datas=new share.ChartDatas() {
|
|
Title ="初始化标题",
|
|
Title ="初始化标题",
|
|
@@ -97,16 +64,61 @@ namespace wispro.sp.web.Pages.Report
|
|
|
|
|
|
if (Datas != null)
|
|
if (Datas != null)
|
|
{
|
|
{
|
|
- config4.Title.Text = Datas.Title;
|
|
|
|
- config4.XField = Datas.ATitle;
|
|
|
|
- await chart.ChangeData(Datas.Datas);
|
|
|
|
- await chart.UpdateChart(config4);
|
|
|
|
|
|
+ Option1 = GetPieOption(Datas);
|
|
|
|
+ pieChart.Refresh();
|
|
StateHasChanged();
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
|
|
|
|
await base.OnInitializedAsync();
|
|
await base.OnInitializedAsync();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private EChartsOption<P.Pie> GetPieOption(share.ChartDatas datas)
|
|
|
|
+ {
|
|
|
|
+ List<object> seriesData = new List<object>();
|
|
|
|
+
|
|
|
|
+ foreach(var data in datas.Datas)
|
|
|
|
+ {
|
|
|
|
+ seriesData.Add(new { Name = data.type, Value = data.value });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Option1 = new()
|
|
|
|
+ {
|
|
|
|
+ Title= new Blazor.ECharts.Options.Title()
|
|
|
|
+ {
|
|
|
|
+ Text = datas.Title ,
|
|
|
|
+ Left = "center"
|
|
|
|
+ },
|
|
|
|
+ Tooltip = new()
|
|
|
|
+ {
|
|
|
|
+ Trigger = TooltipTrigger.Item,
|
|
|
|
+ Formatter = "{a} <br/>{b}: {c} ({d}%)"
|
|
|
|
+ },
|
|
|
|
+ Legend = new()
|
|
|
|
+ {
|
|
|
|
+ Show = false,
|
|
|
|
+ Orient = Orient.Vertical,
|
|
|
|
+ Left = 10,
|
|
|
|
+ Data = datas.GetSeries()
|
|
|
|
+ },
|
|
|
|
+ Series = new()
|
|
|
|
+ {
|
|
|
|
+ new P.Pie()
|
|
|
|
+ {
|
|
|
|
+ Name = datas.Title,
|
|
|
|
+ Radius = new[] { "50%", "70%" },
|
|
|
|
+ AvoidLabelOverlap = false,
|
|
|
|
+ //Label = new()
|
|
|
|
+ //{
|
|
|
|
+ // Show = true,
|
|
|
|
+ // Position = LabelPosition.Inside,
|
|
|
|
+ //},
|
|
|
|
+ //LabelLine = new() { Show = true },
|
|
|
|
+ Data = seriesData
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+
|
|
private void OnTimeRangeChange(DateRangeChangedEventArgs args)
|
|
private void OnTimeRangeChange(DateRangeChangedEventArgs args)
|
|
{
|
|
{
|
|
msgService.Info($"Selected Time: {JsonSerializer.Serialize(args.Dates)}");
|
|
msgService.Info($"Selected Time: {JsonSerializer.Serialize(args.Dates)}");
|
|
@@ -132,10 +144,8 @@ namespace wispro.sp.web.Pages.Report
|
|
|
|
|
|
if (Datas != null)
|
|
if (Datas != null)
|
|
{
|
|
{
|
|
- config4.Title.Text = Datas.Title;
|
|
|
|
- config4.XField = Datas.ATitle;
|
|
|
|
- await chart.ChangeData(Datas.Datas);
|
|
|
|
- await chart.UpdateChart(config4);
|
|
|
|
|
|
+ Option1 = GetPieOption(Datas);
|
|
|
|
+ pieChart.Refresh();
|
|
StateHasChanged();
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
_noIconLoading = false;
|
|
_noIconLoading = false;
|