Update
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
@code {
|
||||
[Parameter] public ReplayDataSeries? DataSeries { get; set; }
|
||||
|
||||
private List<ReplayDataPoint> PowerData => DataSeries?.GetSeries("Boiler", "PowerWatts").ToList() ?? [];
|
||||
private List<ReplayDataPoint> BudgetData => DataSeries?.GetSeries("Boiler", "BudgetPercent").ToList() ?? [];
|
||||
private List<ReplayDataPoint> SwitchData => DataSeries?.GetSeries("Boiler", "SwitchState").ToList() ?? [];
|
||||
|
||||
private ApexChartOptions<ReplayDataPoint> ChartOptions => new()
|
||||
{
|
||||
Chart = new Chart { Background = "transparent", ForeColor = "#adb5bd" },
|
||||
Theme = new Theme { Mode = Mode.Dark },
|
||||
Stroke = new Stroke { Width = 2 },
|
||||
Xaxis = new XAxis { Type = XAxisType.Datetime },
|
||||
Yaxis =
|
||||
[
|
||||
new YAxis { Title = new AxisTitle { Text = "Watts" }, SeriesName = "Power (W)", DecimalsInFloat = 0 },
|
||||
new YAxis { Title = new AxisTitle { Text = "%" }, SeriesName = "Budget %", Opposite = true, Max = 100, DecimalsInFloat = 0 }
|
||||
],
|
||||
Tooltip = new Tooltip { X = new TooltipX { Format = "HH:mm" } },
|
||||
Grid = new Grid { BorderColor = "#343a40" }
|
||||
};
|
||||
}
|
||||
|
||||
@if (PowerData.Count > 0)
|
||||
{
|
||||
<ApexChart TItem="ReplayDataPoint" Options="ChartOptions" Height="300">
|
||||
<ApexPointSeries TItem="ReplayDataPoint"
|
||||
Items="PowerData"
|
||||
SeriesType="SeriesType.Area"
|
||||
Name="Power (W)"
|
||||
XValue="p => p.Timestamp.ToLocalTime().DateTime"
|
||||
YValue="p => (decimal)p.Value" />
|
||||
<ApexPointSeries TItem="ReplayDataPoint"
|
||||
Items="BudgetData"
|
||||
SeriesType="SeriesType.Line"
|
||||
Name="Budget %"
|
||||
XValue="p => p.Timestamp.ToLocalTime().DateTime"
|
||||
YValue="p => (decimal)p.Value" />
|
||||
</ApexChart>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="text-muted text-center py-4">No boiler data available</div>
|
||||
}
|
||||
Reference in New Issue
Block a user