Changed from daily records to quarter hour records
This commit is contained in:
@@ -14,10 +14,10 @@
|
||||
@if (_isLoadingFile){ <p>Loading...</p> }
|
||||
@if (EnergyData.Length != 0){
|
||||
<RadzenChart>
|
||||
<RadzenAreaSeries Smooth=true Data="@EnergyData" CategoryProperty="Date" Title="Consumption" ValueProperty="TotalConsumption">
|
||||
<RadzenAreaSeries Smooth=true Data="@EnergyData" CategoryProperty="Time" Title="Consumption" ValueProperty="Consumption">
|
||||
<RadzenChartTooltipOptions Visible="true" />
|
||||
</RadzenAreaSeries>
|
||||
<RadzenAreaSeries Smooth=true Data="@EnergyData" CategoryProperty="Date" Title="Production" ValueProperty="TotalProduction">
|
||||
<RadzenAreaSeries Smooth=true Data="@EnergyData" CategoryProperty="Time" Title="Production" ValueProperty="Production">
|
||||
<RadzenChartTooltipOptions Visible="true" />
|
||||
</RadzenAreaSeries>
|
||||
<RadzenCategoryAxis Formatter="@FormatObject" Padding="20" LabelAutoRotation="-45">
|
||||
@@ -30,16 +30,7 @@
|
||||
</RadzenChart>
|
||||
}
|
||||
|
||||
|
||||
<h2>Simulate Battery</h2>
|
||||
<p>Set the battery capacity</p>
|
||||
<InputNumber @bind-value="BatteryCapacity"/>
|
||||
<Button @onclick="SimulateBattery">Simulate</Button>
|
||||
|
||||
<h2>Calculate Cost</h2>
|
||||
|
||||
|
||||
@code {
|
||||
@code{
|
||||
EnergyData[] EnergyData = [];
|
||||
bool _isLoadingFile = false;
|
||||
|
||||
@@ -72,24 +63,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
bool _showProduction = true;
|
||||
bool _showConsumption = true;
|
||||
|
||||
private void OnSeriesClick(){}
|
||||
private string FormatObject(object value) {
|
||||
if(value is double d) return $"{value:0.##} kWh";
|
||||
if(value is DateOnly date) return (date.Day == 1) ? date.ToString("MM/yyyy") : string.Empty;
|
||||
else return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
<h2>Simulate Battery</h2>
|
||||
<p>Set the battery capacity</p>
|
||||
<InputNumber @bind-value="BatteryCapacity"/>
|
||||
<Button @onclick="SimulateBattery">Simulate</Button>
|
||||
|
||||
<h2>Calculate Cost</h2>
|
||||
|
||||
|
||||
@code {
|
||||
double BatteryCapacity = 0.0;
|
||||
BatteryDayResult[] SimulationData = [];
|
||||
|
||||
|
||||
private async Task SimulateBattery(){
|
||||
Console.WriteLine("Simulating...");
|
||||
SimulationData = BatterySimulator.SimulateBattery(EnergyData, BatteryCapacity).ToArray();
|
||||
Console.WriteLine("Done simulating!");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
@page "/Test"
|
||||
@using Radzen
|
||||
@using Radzen.Blazor
|
||||
@using System.Globalization
|
||||
|
||||
|
||||
<PageTitle>Home</PageTitle>
|
||||
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
Welcome to your new app.
|
||||
|
||||
<h2>A Radzen chart:</h2>
|
||||
|
||||
<RadzenChart SeriesClick=@OnSeriesClick style="height: 400px">
|
||||
<RadzenBarSeries Data="@revenue2024" CategoryProperty="Quarter" Title="2024" LineType="LineType.Dashed" ValueProperty="Revenue">
|
||||
<RadzenSeriesDataLabels Visible="@showDataLabels" />
|
||||
</RadzenBarSeries>
|
||||
<RadzenBarSeries Data="@revenue2023" CategoryProperty="Quarter" Title="2023" ValueProperty="Revenue">
|
||||
<RadzenSeriesDataLabels Visible="@showDataLabels" />
|
||||
</RadzenBarSeries>
|
||||
<RadzenValueAxis Formatter="@FormatAsUSD">
|
||||
<RadzenGridLines Visible="true" />
|
||||
<RadzenAxisTitle Text="Revenue in USD" />
|
||||
</RadzenValueAxis>
|
||||
<RadzenBarOptions Radius="5" />
|
||||
</RadzenChart>
|
||||
|
||||
|
||||
@code {
|
||||
bool showDataLabels = false;
|
||||
|
||||
void OnSeriesClick(SeriesClickEventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class DataItem
|
||||
{
|
||||
public string Quarter { get; set; }
|
||||
public double Revenue { get; set; }
|
||||
}
|
||||
|
||||
string FormatAsUSD(object value)
|
||||
{
|
||||
return ((double)value).ToString("C0", CultureInfo.CreateSpecificCulture("en-US"));
|
||||
}
|
||||
|
||||
DataItem[] revenue2023 = new DataItem[]
|
||||
{
|
||||
new DataItem
|
||||
{
|
||||
Quarter = "Q1",
|
||||
Revenue = 234000
|
||||
},
|
||||
new DataItem
|
||||
{
|
||||
Quarter = "Q2",
|
||||
Revenue = 284000
|
||||
},
|
||||
new DataItem
|
||||
{
|
||||
Quarter = "Q3",
|
||||
Revenue = 274000
|
||||
},
|
||||
new DataItem
|
||||
{
|
||||
Quarter = "Q4",
|
||||
Revenue = 294000
|
||||
},
|
||||
};
|
||||
|
||||
DataItem[] revenue2024 = new DataItem[] {
|
||||
new DataItem
|
||||
{
|
||||
Quarter = "Q1",
|
||||
Revenue = 254000
|
||||
},
|
||||
new DataItem
|
||||
{
|
||||
Quarter = "Q2",
|
||||
Revenue = 324000
|
||||
},
|
||||
new DataItem
|
||||
{
|
||||
Quarter = "Q3",
|
||||
Revenue = 354000
|
||||
},
|
||||
new DataItem
|
||||
{
|
||||
Quarter = "Q4",
|
||||
Revenue = 394000
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user