-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Backiaraj/chart
Update the project
- Loading branch information
Showing
50 changed files
with
1,630 additions
and
1,316 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
<Router AppAssembly="@typeof(Program).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | ||
</Found> | ||
<NotFound> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<p>Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> | ||
<Router AppAssembly="@typeof(App).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | ||
<FocusOnNavigate RouteData="@routeData" Selector="h1" /> | ||
</Found> | ||
<NotFound> | ||
<PageTitle>Not found</PageTitle> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<p role="alert">Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.2" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.2" PrivateAssets="all" /> | ||
<PackageReference Include="Syncfusion.Blazor.Charts" Version="23.1.41" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Shared\CustomDateTimeAxis.Shared.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
@page "/counter" | ||
|
||
<h1>Counter</h1> | ||
|
||
<p>Current count: @currentCount</p> | ||
|
||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button> | ||
|
||
@code { | ||
private int currentCount = 0; | ||
|
||
private void IncrementCount() | ||
{ | ||
currentCount++; | ||
} | ||
} | ||
@page "/counter" | ||
|
||
<PageTitle>Counter</PageTitle> | ||
|
||
<h1>Counter</h1> | ||
|
||
<p role="status">Current count: @currentCount</p> | ||
|
||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button> | ||
|
||
@code { | ||
private int currentCount = 0; | ||
|
||
private void IncrementCount() | ||
{ | ||
currentCount++; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,47 @@ | ||
@page "/fetchdata" | ||
@inject HttpClient Http | ||
|
||
<h1>Weather forecast</h1> | ||
|
||
<p>This component demonstrates fetching data from the server.</p> | ||
|
||
@if (forecasts == null) | ||
{ | ||
<p><em>Loading...</em></p> | ||
} | ||
else | ||
{ | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Date</th> | ||
<th>Temp. (C)</th> | ||
<th>Temp. (F)</th> | ||
<th>Summary</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach (var forecast in forecasts) | ||
{ | ||
<tr> | ||
<td>@forecast.Date.ToShortDateString()</td> | ||
<td>@forecast.TemperatureC</td> | ||
<td>@forecast.TemperatureF</td> | ||
<td>@forecast.Summary</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
} | ||
|
||
@code { | ||
private WeatherForecast[] forecasts; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json"); | ||
} | ||
|
||
public class WeatherForecast | ||
{ | ||
public DateTime Date { get; set; } | ||
|
||
public int TemperatureC { get; set; } | ||
|
||
public string Summary { get; set; } | ||
|
||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); | ||
} | ||
} | ||
@page "/fetchdata" | ||
@using CustomDateTimeAxis.Shared | ||
@inject HttpClient Http | ||
|
||
<PageTitle>Weather forecast</PageTitle> | ||
|
||
<h1>Weather forecast</h1> | ||
|
||
<p>This component demonstrates fetching data from the server.</p> | ||
|
||
@if (forecasts == null) | ||
{ | ||
<p><em>Loading...</em></p> | ||
} | ||
else | ||
{ | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Date</th> | ||
<th>Temp. (C)</th> | ||
<th>Temp. (F)</th> | ||
<th>Summary</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach (var forecast in forecasts) | ||
{ | ||
<tr> | ||
<td>@forecast.Date.ToShortDateString()</td> | ||
<td>@forecast.TemperatureC</td> | ||
<td>@forecast.TemperatureF</td> | ||
<td>@forecast.Summary</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
} | ||
|
||
@code { | ||
private WeatherForecast[]? forecasts; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("WeatherForecast"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,69 @@ | ||
@page "/" | ||
|
||
<SfChart Title="Weather Statistics"> | ||
@* <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.DateTime" Title="Date Time" | ||
LabelFormat="yyyy MMM" Maximum="@(new DateTime(2021, 07, 1))" | ||
Minimum="@(new DateTime(2015, 12, 31))" EdgeLabelPlacement="EdgeLabelPlacement.Shift" | ||
Interval="6" IntervalType="IntervalType.Months"> | ||
</ChartPrimaryXAxis> | ||
<ChartPrimaryYAxis Title="Temperature"> | ||
</ChartPrimaryYAxis> | ||
<ChartSeriesCollection> | ||
<ChartSeries Type="ChartSeriesType.Line" DataSource="@ChartData" XName="Date" | ||
YName="Temperature"> | ||
<ChartMarker Visible="true" Height="10" Width="10"></ChartMarker> | ||
</ChartSeries> | ||
</ChartSeriesCollection>*@ | ||
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.DateTimeCategory" | ||
Title="Business Days" LabelFormat="d" | ||
EdgeLabelPlacement="EdgeLabelPlacement.Shift"> | ||
</ChartPrimaryXAxis> | ||
<ChartPrimaryYAxis Title="Profit"> | ||
</ChartPrimaryYAxis> | ||
<ChartSeriesCollection> | ||
<ChartSeries Type="ChartSeriesType.Column" DataSource="@ChartData" XName="Date" | ||
YName="Profit"> | ||
</ChartSeries> | ||
</ChartSeriesCollection> | ||
</SfChart> | ||
|
||
@code { | ||
|
||
public class ChartDataModel | ||
{ | ||
public DateTime Date { get; set; } | ||
public double Temperature { get; set; } | ||
public int Profit { get; set; } | ||
} | ||
|
||
// Date time category Axis | ||
List<ChartDataModel> ChartData = new List<ChartDataModel> | ||
{ | ||
new ChartDataModel { Date = new DateTime(2020, 12, 21), Profit = 21 }, | ||
new ChartDataModel { Date = new DateTime(2020, 12, 22), Profit = 24}, | ||
new ChartDataModel { Date = new DateTime(2020, 12, 24), Profit = 25 }, | ||
new ChartDataModel { Date = new DateTime(2020, 12, 28), Profit = 70 }, | ||
new ChartDataModel { Date = new DateTime(2021, 1, 4), Profit = 82 }, | ||
new ChartDataModel { Date = new DateTime(2021, 1, 6), Profit = 53 }, | ||
new ChartDataModel { Date = new DateTime(2021, 1, 8), Profit = 45 }, | ||
new ChartDataModel { Date = new DateTime(2021, 1, 11), Profit = 60 } | ||
}; | ||
|
||
// Date time Axis | ||
//List<ChartDataModel> ChartData = new List<ChartDataModel> | ||
//{ | ||
// new ChartDataModel { Date = new DateTime(2016, 3, 1), Temperature = 6.3 }, | ||
// new ChartDataModel { Date = new DateTime(2016, 5, 1), Temperature = 13.3 }, | ||
// new ChartDataModel { Date = new DateTime(2017, 7, 1), Temperature = 8.0 }, | ||
// new ChartDataModel { Date = new DateTime(2017, 4, 1), Temperature = 17.3 }, | ||
// new ChartDataModel { Date = new DateTime(2018, 5, 1), Temperature = 19.8 }, | ||
// new ChartDataModel { Date = new DateTime(2018, 9, 1), Temperature = 5.1 }, | ||
// new ChartDataModel { Date = new DateTime(2019, 2, 1), Temperature = 10.1 }, | ||
// new ChartDataModel { Date = new DateTime(2019, 7, 1), Temperature = 9.6 }, | ||
// new ChartDataModel { Date = new DateTime(2020, 5, 1), Temperature = 18.1 }, | ||
// new ChartDataModel { Date = new DateTime(2020, 12, 15), Temperature = 8.2 } | ||
//}; | ||
@page "/" | ||
|
||
<SfChart Title="Weather Statistics"> | ||
@* <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.DateTime" Title="Date Time" | ||
LabelFormat="yyyy MMM" Maximum="@(new DateTime(2021, 07, 1))" | ||
Minimum="@(new DateTime(2015, 12, 31))" EdgeLabelPlacement="EdgeLabelPlacement.Shift" | ||
Interval="6" IntervalType="IntervalType.Months"> | ||
</ChartPrimaryXAxis> | ||
<ChartPrimaryYAxis Title="Temperature"> | ||
</ChartPrimaryYAxis> | ||
<ChartSeriesCollection> | ||
<ChartSeries Type="ChartSeriesType.Line" DataSource="@ChartData" XName="Date" | ||
YName="Temperature"> | ||
<ChartMarker Visible="true" Height="10" Width="10"></ChartMarker> | ||
</ChartSeries> | ||
</ChartSeriesCollection>*@ | ||
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.DateTimeCategory" | ||
Title="Business Days" LabelFormat="d" | ||
EdgeLabelPlacement="EdgeLabelPlacement.Shift"> | ||
</ChartPrimaryXAxis> | ||
<ChartPrimaryYAxis Title="Profit"> | ||
</ChartPrimaryYAxis> | ||
<ChartSeriesCollection> | ||
<ChartSeries Type="ChartSeriesType.Column" DataSource="@ChartData" XName="Date" | ||
YName="Profit"> | ||
</ChartSeries> | ||
</ChartSeriesCollection> | ||
</SfChart> | ||
|
||
@code { | ||
|
||
public class ChartDataModel | ||
{ | ||
public DateTime Date { get; set; } | ||
public double Temperature { get; set; } | ||
public int Profit { get; set; } | ||
} | ||
|
||
// Date time category Axis | ||
List<ChartDataModel> ChartData = new List<ChartDataModel> | ||
{ | ||
new ChartDataModel { Date = new DateTime(2020, 12, 21), Profit = 21 }, | ||
new ChartDataModel { Date = new DateTime(2020, 12, 22), Profit = 24}, | ||
new ChartDataModel { Date = new DateTime(2020, 12, 24), Profit = 25 }, | ||
new ChartDataModel { Date = new DateTime(2020, 12, 28), Profit = 70 }, | ||
new ChartDataModel { Date = new DateTime(2021, 1, 4), Profit = 82 }, | ||
new ChartDataModel { Date = new DateTime(2021, 1, 6), Profit = 53 }, | ||
new ChartDataModel { Date = new DateTime(2021, 1, 8), Profit = 45 }, | ||
new ChartDataModel { Date = new DateTime(2021, 1, 11), Profit = 60 } | ||
}; | ||
|
||
// Date time Axis | ||
//List<ChartDataModel> ChartData = new List<ChartDataModel> | ||
//{ | ||
// new ChartDataModel { Date = new DateTime(2016, 3, 1), Temperature = 6.3 }, | ||
// new ChartDataModel { Date = new DateTime(2016, 5, 1), Temperature = 13.3 }, | ||
// new ChartDataModel { Date = new DateTime(2017, 7, 1), Temperature = 8.0 }, | ||
// new ChartDataModel { Date = new DateTime(2017, 4, 1), Temperature = 17.3 }, | ||
// new ChartDataModel { Date = new DateTime(2018, 5, 1), Temperature = 19.8 }, | ||
// new ChartDataModel { Date = new DateTime(2018, 9, 1), Temperature = 5.1 }, | ||
// new ChartDataModel { Date = new DateTime(2019, 2, 1), Temperature = 10.1 }, | ||
// new ChartDataModel { Date = new DateTime(2019, 7, 1), Temperature = 9.6 }, | ||
// new ChartDataModel { Date = new DateTime(2020, 5, 1), Temperature = 18.1 }, | ||
// new ChartDataModel { Date = new DateTime(2020, 12, 15), Temperature = 8.2 } | ||
//}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using CustomDateTimeAxis.Client; | ||
using Microsoft.AspNetCore.Components.Web; | ||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | ||
using Syncfusion.Blazor; | ||
|
||
var builder = WebAssemblyHostBuilder.CreateDefault(args); | ||
builder.RootComponents.Add<App>("#app"); | ||
builder.RootComponents.Add<HeadOutlet>("head::after"); | ||
|
||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); | ||
builder.Services.AddSyncfusionBlazor(); | ||
await builder.Build().RunAsync(); |
Oops, something went wrong.