123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- @using wispro.sp.web.Services
- <AntDesign.Charts.Radar @ref="_chart" TItem="RadarDataItem" Config="_chartConfig"/>
- @if (HasLegend)
- {
- <Row Class="legend">
- <AntDesign.Col>
- <div class="legendItem">
- <p>
- <span class="dot" style="background-color: #aaa"></span>
- <span></span>
- </p>
- <h6></h6>
- </div>
- </AntDesign.Col>
- </Row>
- }
- @inject IChartService ChartService
- @code
- {
- [Parameter]
- public bool HasLegend { get; set; } = false;
- [Parameter]
- public int Height { get; set; } = 343;
- private IChartComponent _chart;
- private readonly RadarConfig _chartConfig = new RadarConfig
- {
- Height = 400,
- ForceFit = true,
- AngleField = "label",
- RadiusField = "value",
- SeriesField = "name",
- RadiusAxis = new ValueAxis
- {
- Grid = new BaseAxisGrid
- {
- Line = new BaseAxisGridLine
- {
- Type = "line"
- }
- }
- },
- Area = new RadarViewConfigArea
- {
- Visible = false
- },
- Point = new RadarViewConfigPoint
- {
- Visible = true
- },
- Legend = new Legend
- {
- Visible = true,
- Position = "bottom-center"
- },
- };
- protected override async System.Threading.Tasks.Task OnInitializedAsync()
- {
- await base.OnInitializedAsync();
- try
- {
- var data = await ChartService.GetRadarDataAsync();
- await _chart.ChangeData(data);
- }
- catch { }
- }
- }
|