Skip to content

Commit b97c45a

Browse files
ASP.NET Core Accumulation Charts sample
ASP.NET Core Accumulation Charts sample
1 parent f7bba76 commit b97c45a

File tree

79 files changed

+74850
-2
lines changed

Some content is hidden

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

79 files changed

+74850
-2
lines changed

Pages/Error.cshtml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@page
2+
@model ErrorModel
3+
@{
4+
ViewData["Title"] = "Error";
5+
}
6+
7+
<h1 class="text-danger">Error.</h1>
8+
<h2 class="text-danger">An error occurred while processing your request.</h2>
9+
10+
@if (Model.ShowRequestId)
11+
{
12+
<p>
13+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
14+
</p>
15+
}
16+
17+
<h3>Development Mode</h3>
18+
<p>
19+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
20+
</p>
21+
<p>
22+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
23+
It can result in displaying sensitive information from exceptions to end users.
24+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
25+
and restarting the app.
26+
</p>

Pages/Error.cshtml.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
using System.Diagnostics;
4+
5+
namespace mycoreproject.Pages
6+
{
7+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
8+
[IgnoreAntiforgeryToken]
9+
public class ErrorModel : PageModel
10+
{
11+
public string? RequestId { get; set; }
12+
13+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
14+
15+
private readonly ILogger<ErrorModel> _logger;
16+
17+
public ErrorModel(ILogger<ErrorModel> logger)
18+
{
19+
_logger = logger;
20+
}
21+
22+
public void OnGet()
23+
{
24+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
25+
}
26+
}
27+
28+
}

Pages/Index.cshtml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@page
2+
@model IndexModel
3+
@{
4+
ViewData["Title"] = "Home page";
5+
List<ChartData> Data = new List<ChartData>()
6+
{
7+
new ChartData { Browser= "Chrome", Users= 59.28 },
8+
new ChartData { Browser= "UC Browser", Users= 4.37 },
9+
new ChartData { Browser= "Internet Explorer", Users= 6.12 },
10+
new ChartData { Browser= "Sogou Explorer", Users= 1.73 },
11+
new ChartData { Browser= "QQ", Users= 3.96 },
12+
new ChartData { Browser= "Safari", Users= 4.73 },
13+
new ChartData { Browser= "Opera", Users= 3.12 },
14+
new ChartData { Browser= "Edge", Users= 7.48 },
15+
new ChartData { Browser= "Others", Users= 9.57 }
16+
};
17+
}
18+
19+
<ejs-accumulationchart id="chart" title="Browser Market Share">
20+
<e-accumulationchart-tooltipsettings enable=true>
21+
</e-accumulationchart-tooltipsettings>
22+
<e-accumulation-series-collection>
23+
<e-accumulation-series type="Pyramid"
24+
dataSource="Data"
25+
xName="Browser"
26+
yName="Users">
27+
<e-accumulationseries-datalabel visible=true>
28+
</e-accumulationseries-datalabel>
29+
</e-accumulation-series>
30+
</e-accumulation-series-collection>
31+
</ejs-accumulationchart>

Pages/Index.cshtml.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
4+
namespace mycoreproject.Pages
5+
{
6+
public class ChartData
7+
{
8+
public string Browser { get; set; }
9+
public double Users { get; set; }
10+
}
11+
public class IndexModel : PageModel
12+
{
13+
public void OnGet()
14+
{
15+
16+
}
17+
}
18+
}

Pages/Privacy.cshtml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@page
2+
@model PrivacyModel
3+
@{
4+
ViewData["Title"] = "Privacy Policy";
5+
}
6+
<h1>@ViewData["Title"]</h1>
7+
8+
<p>Use this page to detail your site's privacy policy.</p>

Pages/Privacy.cshtml.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
4+
namespace mycoreproject.Pages
5+
{
6+
public class PrivacyModel : PageModel
7+
{
8+
private readonly ILogger<PrivacyModel> _logger;
9+
10+
public PrivacyModel(ILogger<PrivacyModel> logger)
11+
{
12+
_logger = logger;
13+
}
14+
15+
public void OnGet()
16+
{
17+
}
18+
}
19+
20+
}

Pages/Shared/_Layout.cshtml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>@ViewData["Title"] - mycoreproject</title>
7+
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
8+
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
9+
<link rel="stylesheet" href="~/mycoreproject.styles.css" asp-append-version="true" />
10+
<script src="https://cdn.syncfusion.com/ej2/24.1.46/dist/ej2.min.js"></script>
11+
</head>
12+
<body>
13+
<div class="container" style="padding:10px">
14+
<main role="main" class="pb-3">
15+
@RenderBody()
16+
</main>
17+
</div>
18+
19+
<script src="~/lib/jquery/dist/jquery.min.js"></script>
20+
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
21+
<script src="~/js/site.js" asp-append-version="true"></script>
22+
23+
@await RenderSectionAsync("Scripts", required: false)
24+
<ejs-scripts></ejs-scripts>
25+
</body>
26+
</html>

Pages/Shared/_Layout.cshtml.css

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
2+
for details on configuring this project to bundle and minify static web assets. */
3+
4+
a.navbar-brand {
5+
white-space: normal;
6+
text-align: center;
7+
word-break: break-all;
8+
}
9+
10+
a {
11+
color: #0077cc;
12+
}
13+
14+
.btn-primary {
15+
color: #fff;
16+
background-color: #1b6ec2;
17+
border-color: #1861ac;
18+
}
19+
20+
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
21+
color: #fff;
22+
background-color: #1b6ec2;
23+
border-color: #1861ac;
24+
}
25+
26+
.border-top {
27+
border-top: 1px solid #e5e5e5;
28+
}
29+
.border-bottom {
30+
border-bottom: 1px solid #e5e5e5;
31+
}
32+
33+
.box-shadow {
34+
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
35+
}
36+
37+
button.accept-policy {
38+
font-size: 1rem;
39+
line-height: inherit;
40+
}
41+
42+
.footer {
43+
position: absolute;
44+
bottom: 0;
45+
width: 100%;
46+
white-space: nowrap;
47+
line-height: 60px;
48+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
2+
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

Pages/_ViewImports.cshtml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@using mycoreproject
2+
@namespace mycoreproject.Pages
3+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4+
@addTagHelper *, Syncfusion.EJ2

0 commit comments

Comments
 (0)