Skip to content

Commit 76e6341

Browse files
Merge pull request #1 from Backiaraj/treemap
Update the project
2 parents c52bf5f + 0133afe commit 76e6341

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1611
-1308
lines changed
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<Router AppAssembly="@typeof(Program).Assembly">
2-
<Found Context="routeData">
3-
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4-
</Found>
5-
<NotFound>
6-
<LayoutView Layout="@typeof(MainLayout)">
7-
<p>Sorry, there's nothing at this address.</p>
8-
</LayoutView>
9-
</NotFound>
10-
</Router>
1+
<Router AppAssembly="@typeof(App).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
5+
</Found>
6+
<NotFound>
7+
<PageTitle>Not found</PageTitle>
8+
<LayoutView Layout="@typeof(MainLayout)">
9+
<p role="alert">Sorry, there's nothing at this address.</p>
10+
</LayoutView>
11+
</NotFound>
12+
</Router>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.2" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.2" PrivateAssets="all" />
12+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="23.1.39" />
13+
<PackageReference Include="Syncfusion.Blazor.TreeMap" Version="23.1.39" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<ProjectReference Include="..\Shared\CreatingTreeMapSample.Shared.csproj" />
18+
</ItemGroup>
19+
20+
</Project>
Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
@page "/counter"
2-
3-
<h1>Counter</h1>
4-
5-
<p>Current count: @currentCount</p>
6-
7-
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
8-
9-
@code {
10-
private int currentCount = 0;
11-
12-
private void IncrementCount()
13-
{
14-
currentCount++;
15-
}
16-
}
1+
@page "/counter"
2+
3+
<PageTitle>Counter</PageTitle>
4+
5+
<h1>Counter</h1>
6+
7+
<p role="status">Current count: @currentCount</p>
8+
9+
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
10+
11+
@code {
12+
private int currentCount = 0;
13+
14+
private void IncrementCount()
15+
{
16+
currentCount++;
17+
}
18+
}
Lines changed: 47 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,47 @@
1-
@page "/fetchdata"
2-
@inject HttpClient Http
3-
4-
<h1>Weather forecast</h1>
5-
6-
<p>This component demonstrates fetching data from the server.</p>
7-
8-
@if (forecasts == null)
9-
{
10-
<p><em>Loading...</em></p>
11-
}
12-
else
13-
{
14-
<table class="table">
15-
<thead>
16-
<tr>
17-
<th>Date</th>
18-
<th>Temp. (C)</th>
19-
<th>Temp. (F)</th>
20-
<th>Summary</th>
21-
</tr>
22-
</thead>
23-
<tbody>
24-
@foreach (var forecast in forecasts)
25-
{
26-
<tr>
27-
<td>@forecast.Date.ToShortDateString()</td>
28-
<td>@forecast.TemperatureC</td>
29-
<td>@forecast.TemperatureF</td>
30-
<td>@forecast.Summary</td>
31-
</tr>
32-
}
33-
</tbody>
34-
</table>
35-
}
36-
37-
@code {
38-
private WeatherForecast[] forecasts;
39-
40-
protected override async Task OnInitializedAsync()
41-
{
42-
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
43-
}
44-
45-
public class WeatherForecast
46-
{
47-
public DateTime Date { get; set; }
48-
49-
public int TemperatureC { get; set; }
50-
51-
public string Summary { get; set; }
52-
53-
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
54-
}
55-
}
1+
@page "/fetchdata"
2+
@using CreatingTreeMapSample.Shared
3+
@inject HttpClient Http
4+
5+
<PageTitle>Weather forecast</PageTitle>
6+
7+
<h1>Weather forecast</h1>
8+
9+
<p>This component demonstrates fetching data from the server.</p>
10+
11+
@if (forecasts == null)
12+
{
13+
<p><em>Loading...</em></p>
14+
}
15+
else
16+
{
17+
<table class="table">
18+
<thead>
19+
<tr>
20+
<th>Date</th>
21+
<th>Temp. (C)</th>
22+
<th>Temp. (F)</th>
23+
<th>Summary</th>
24+
</tr>
25+
</thead>
26+
<tbody>
27+
@foreach (var forecast in forecasts)
28+
{
29+
<tr>
30+
<td>@forecast.Date.ToShortDateString()</td>
31+
<td>@forecast.TemperatureC</td>
32+
<td>@forecast.TemperatureF</td>
33+
<td>@forecast.Summary</td>
34+
</tr>
35+
}
36+
</tbody>
37+
</table>
38+
}
39+
40+
@code {
41+
private WeatherForecast[]? forecasts;
42+
43+
protected override async Task OnInitializedAsync()
44+
{
45+
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("WeatherForecast");
46+
}
47+
}
Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
@page "/"
2-
@using Syncfusion.Blazor.TreeMap
3-
4-
5-
<SfTreeMap DataSource="@growthReport" TValue="Country" WeightValuePath="GDP" RangeColorValuePath="GDP">
6-
<TreeMapTitleSettings Text="Top 10 countries by GDP Nominal - 2015"></TreeMapTitleSettings>
7-
<TreeMapLegendSettings Visible="true"></TreeMapLegendSettings>
8-
<TreeMapLeafItemSettings LabelPath="Name">
9-
<TreeMapLeafColorMappings>
10-
<TreeMapLeafColorMapping From="1" To="3000" Color="@("Orange")"></TreeMapLeafColorMapping>
11-
<TreeMapLeafColorMapping From="3000" To="20000" Color="@("Green")"></TreeMapLeafColorMapping>
12-
</TreeMapLeafColorMappings>
13-
</TreeMapLeafItemSettings>
14-
</SfTreeMap>
15-
16-
@code{
17-
18-
public class Country
19-
{
20-
public string Name { get; set; }
21-
public double GDP { get; set; }
22-
}
23-
24-
private List<Country> growthReport = new List<Country>()
25-
{
26-
new Country { Name = "United States", GDP = 17946 },
27-
new Country { Name = "China", GDP = 10866 },
28-
new Country { Name = "Japan", GDP = 4123 },
29-
new Country { Name = "Germany", GDP = 3355 },
30-
new Country { Name = "United Kingdom", GDP = 2848 },
31-
new Country { Name = "France", GDP = 2421 },
32-
new Country { Name = "India", GDP = 2073 },
33-
new Country { Name = "Italy", GDP = 1814 },
34-
new Country { Name = "Brazil", GDP = 1774 },
35-
new Country { Name = "Canada", GDP = 1550 }
36-
};
1+
@page "/"
2+
3+
<SfTreeMap DataSource="@growthReport"
4+
WeightValuePath="GDP"
5+
TValue="Country"
6+
RangeColorValuePath="GDP">
7+
<TreeMapTitleSettings Text="Top 10 countries by GDP Nominal - 2015"></TreeMapTitleSettings>
8+
<TreeMapLeafItemSettings LabelPath="Name" Fill="lightgray">
9+
<TreeMapLeafColorMappings>
10+
<TreeMapLeafColorMapping StartRange="0" EndRange="3000" Color="@(new string[] { "Orange" })"></TreeMapLeafColorMapping>
11+
<TreeMapLeafColorMapping StartRange="3000" EndRange="20000" Color="@(new string[] { "Green" })"></TreeMapLeafColorMapping>
12+
</TreeMapLeafColorMappings>
13+
</TreeMapLeafItemSettings>
14+
</SfTreeMap>
15+
16+
@code {
17+
18+
public class Country
19+
{
20+
public string Name { get; set; }
21+
public double GDP { get; set; }
22+
}
23+
24+
private List<Country> growthReport = new List<Country>()
25+
{
26+
new Country { Name = "United States", GDP = 17946 },
27+
new Country { Name = "China", GDP = 10866 },
28+
new Country { Name = "Japan", GDP = 4123 },
29+
new Country { Name = "Germany", GDP = 3355 },
30+
new Country { Name = "United Kingdom", GDP = 2848 },
31+
new Country { Name = "France", GDP = 2421 },
32+
new Country { Name = "India", GDP = 2073 },
33+
new Country { Name = "Italy", GDP = 1814 },
34+
new Country { Name = "Brazil", GDP = 1774 },
35+
new Country { Name = "Canada", GDP = 1550 }
36+
};
3737
}

Client/Program.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using CreatingTreeMapSample.Client;
2+
using Microsoft.AspNetCore.Components.Web;
3+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
4+
using Syncfusion.Blazor;
5+
6+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
7+
builder.RootComponents.Add<App>("#app");
8+
builder.RootComponents.Add<HeadOutlet>("head::after");
9+
10+
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
11+
builder.Services.AddSyncfusionBlazor();
12+
await builder.Build().RunAsync();
Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,40 @@
1-
{
2-
"iisSettings": {
3-
"windowsAuthentication": false,
4-
"anonymousAuthentication": true,
5-
"iisExpress": {
6-
"applicationUrl": "http://localhost:50039",
7-
"sslPort": 44302
8-
}
9-
},
10-
"profiles": {
11-
"IIS Express": {
12-
"commandName": "IISExpress",
13-
"launchBrowser": true,
14-
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
15-
"environmentVariables": {
16-
"ASPNETCORE_ENVIRONMENT": "Development"
17-
}
18-
},
19-
"MyBlazorApp": {
20-
"commandName": "Project",
21-
"launchBrowser": true,
22-
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
23-
"applicationUrl": "https://localhost:5001;http://localhost:5000",
24-
"environmentVariables": {
25-
"ASPNETCORE_ENVIRONMENT": "Development"
26-
}
27-
}
28-
}
29-
}
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:49466",
7+
"sslPort": 44388
8+
}
9+
},
10+
"profiles": {
11+
"http": {
12+
"commandName": "Project",
13+
"dotnetRunMessages": true,
14+
"launchBrowser": true,
15+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
16+
"applicationUrl": "http://localhost:5118",
17+
"environmentVariables": {
18+
"ASPNETCORE_ENVIRONMENT": "Development"
19+
}
20+
},
21+
"https": {
22+
"commandName": "Project",
23+
"dotnetRunMessages": true,
24+
"launchBrowser": true,
25+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
26+
"applicationUrl": "https://localhost:7057;http://localhost:5118",
27+
"environmentVariables": {
28+
"ASPNETCORE_ENVIRONMENT": "Development"
29+
}
30+
},
31+
"IIS Express": {
32+
"commandName": "IISExpress",
33+
"launchBrowser": true,
34+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
35+
"environmentVariables": {
36+
"ASPNETCORE_ENVIRONMENT": "Development"
37+
}
38+
}
39+
}
40+
}

Client/Shared/MainLayout.razor

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
<div class="sidebar">
5+
<NavMenu />
6+
</div>
7+
8+
<main>
9+
<div class="top-row px-4">
10+
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
11+
</div>
12+
13+
<article class="content px-4">
14+
@Body
15+
</article>
16+
</main>
17+
</div>

0 commit comments

Comments
 (0)