Skip to content

Commit c7558a6

Browse files
Merge pull request #7 from SyncfusionExamples/960543-Chart
960543: Migrate .net8 version
2 parents cca85ca + 37e57a2 commit c7558a6

36 files changed

+153
-1333
lines changed

App.razor

Lines changed: 0 additions & 12 deletions
This file was deleted.

BlazorChartSample.csproj

Lines changed: 0 additions & 14 deletions
This file was deleted.

BlazorChartSample.sln

Lines changed: 0 additions & 25 deletions
This file was deleted.

Components/App.razor

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<base href="/" />
8+
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
9+
<link rel="stylesheet" href="app.css" />
10+
<link rel="stylesheet" href="BlazorApp.styles.css" />
11+
<link rel="icon" type="image/png" href="favicon.png" />
12+
<HeadOutlet @rendermode="InteractiveServer" />
13+
</head>
14+
15+
<body>
16+
<Routes @rendermode="InteractiveServer" />
17+
<script src="_framework/blazor.web.js"></script>
18+
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
19+
</body>
20+
21+
</html>

Components/Layout/MainLayout.razor

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
<main>
5+
<article class="content px-4">
6+
@Body
7+
</article>
8+
</main>
9+
</div>
10+
11+
<div id="blazor-error-ui">
12+
An unhandled error has occurred.
13+
<a href="" class="reload">Reload</a>
14+
<a class="dismiss">🗙</a>
15+
</div>

Shared/MainLayout.razor.css renamed to Components/Layout/MainLayout.razor.css

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,27 @@ main {
2121
align-items: center;
2222
}
2323

24-
.top-row ::deep a, .top-row .btn-link {
24+
.top-row ::deep a, .top-row ::deep .btn-link {
2525
white-space: nowrap;
2626
margin-left: 1.5rem;
27+
text-decoration: none;
2728
}
2829

29-
.top-row a:first-child {
30+
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
31+
text-decoration: underline;
32+
}
33+
34+
.top-row ::deep a:first-child {
3035
overflow: hidden;
3136
text-overflow: ellipsis;
3237
}
3338

3439
@media (max-width: 640.98px) {
35-
.top-row:not(.auth) {
36-
display: none;
37-
}
38-
39-
.top-row.auth {
40+
.top-row {
4041
justify-content: space-between;
4142
}
4243

43-
.top-row a, .top-row .btn-link {
44+
.top-row ::deep a, .top-row ::deep .btn-link {
4445
margin-left: 0;
4546
}
4647
}
@@ -63,8 +64,33 @@ main {
6364
z-index: 1;
6465
}
6566

67+
.top-row.auth ::deep a:first-child {
68+
flex: 1;
69+
text-align: right;
70+
width: 0;
71+
}
72+
6673
.top-row, article {
6774
padding-left: 2rem !important;
6875
padding-right: 1.5rem !important;
6976
}
7077
}
78+
79+
#blazor-error-ui {
80+
background: lightyellow;
81+
bottom: 0;
82+
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
83+
display: none;
84+
left: 0;
85+
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
86+
position: fixed;
87+
width: 100%;
88+
z-index: 1000;
89+
}
90+
91+
#blazor-error-ui .dismiss {
92+
cursor: pointer;
93+
position: absolute;
94+
right: 0.75rem;
95+
top: 0.5rem;
96+
}

Components/Pages/Home.razor

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
@page "/"
2+
3+
<SfChart Title="Sales Analysis">
4+
<ChartPrimaryXAxis Title="Month" ValueType="Syncfusion.Blazor.Charts.ValueType.Category"></ChartPrimaryXAxis>
5+
<ChartPrimaryYAxis Title="Sales in Dollar"></ChartPrimaryYAxis>
6+
<ChartTooltipSettings Enable="true"></ChartTooltipSettings>
7+
<ChartLegendSettings Visible="true"></ChartLegendSettings>
8+
<ChartSeriesCollection>
9+
<ChartSeries DataSource="@Sales" Name="Sales" XName="Month" YName="SalesValue" Type="ChartSeriesType.Column">
10+
<ChartMarker>
11+
<ChartDataLabel Visible="true"></ChartDataLabel>
12+
</ChartMarker>
13+
</ChartSeries>
14+
</ChartSeriesCollection>
15+
</SfChart>
16+
17+
@code {
18+
public class SalesData
19+
{
20+
public string Month { get; set; }
21+
public double SalesValue { get; set; }
22+
}
23+
24+
public List<SalesData> Sales = new List<SalesData>
25+
{
26+
new SalesData { Month = "Jan", SalesValue = 35 },
27+
new SalesData { Month = "Feb", SalesValue = 28 },
28+
new SalesData { Month = "Mar", SalesValue = 34 },
29+
new SalesData { Month = "Apr", SalesValue = 32 },
30+
new SalesData { Month = "May", SalesValue = 40 },
31+
new SalesData { Month = "Jun", SalesValue = 32 },
32+
new SalesData { Month = "Jul", SalesValue = 35 }
33+
};
34+
}

Components/Routes.razor

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Router AppAssembly="typeof(Program).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)" />
4+
<FocusOnNavigate RouteData="routeData" Selector="h1" />
5+
</Found>
6+
</Router>
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
@using System.Net.Http
2-
@using Microsoft.AspNetCore.Authorization
3-
@using Microsoft.AspNetCore.Components.Authorization
2+
@using System.Net.Http.Json
43
@using Microsoft.AspNetCore.Components.Forms
54
@using Microsoft.AspNetCore.Components.Routing
65
@using Microsoft.AspNetCore.Components.Web
6+
@using static Microsoft.AspNetCore.Components.Web.RenderMode
77
@using Microsoft.AspNetCore.Components.Web.Virtualization
88
@using Microsoft.JSInterop
9-
@using BlazorChartSample
10-
@using BlazorChartSample.Shared
11-
@using Syncfusion.Blazor
9+
@using BlazorApp
10+
@using BlazorApp.Components
1211
@using Syncfusion.Blazor.Charts

Data/WeatherForecast.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)