Files
TechHelper/TechHelper.Client/Pages/Components/GrageView.razor
2025-05-23 19:03:00 +08:00

42 lines
1.2 KiB
Plaintext

<MudPaper Class="pa-5 ma-5 rounded-lg" Width="@Width" >
<MudChart ChartType=@ChartType ChartSeries="@Series" XAxisLabels="@XAxisLabels" Width=@Width Height=@Height ChartOptions=@ChartOptions></MudChart>
</MudPaper>
@code {
private ChartOptions options = new ChartOptions();
public List<ChartSeries> Series = new List<ChartSeries>()
{
new ChartSeries() { Name = "Series 1", Data = new double[] { 90, 79, 72, 69, 62, 62, 55, 65, 70 } },
new ChartSeries() { Name = "Series 2", Data = new double[] { 35, 41, 35, 51, 49, 62, 69, 91, 148 } },
};
[Parameter]
[Category("Behavior")]
public ChartType ChartType { get; set; } = ChartType.Line;
[Parameter]
[Category("Appearance")]
public string Width { get; set; } = "80%";
[Parameter]
[Category("Appearance")]
public ChartOptions ChartOptions { get; set; } = new ChartOptions();
[Parameter]
[Category("Appearance")]
public string Height { get; set; } = "80%";
[Parameter]
public string XAxis { get; set; }
public string[] XAxisLabels = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep" };
protected override async Task OnInitializedAsync()
{
options.InterpolationOption = InterpolationOption.NaturalSpline;
options.YAxisFormat = "c2";
ChartOptions = options;
}
}