Skip to content

Commit 6fc568f

Browse files
Merge pull request #3 from subaa1492/master
Changed the sample for Blazor Charts
2 parents 3aee54d + 14da190 commit 6fc568f

File tree

14 files changed

+61
-51
lines changed

14 files changed

+61
-51
lines changed

App.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
<Router AppAssembly="@typeof(Program).Assembly">
23
<Found Context="routeData">
34
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
<PropertyGroup>
44
<TargetFramework>netcoreapp3.1</TargetFramework>
5-
<RootNamespace>column_charts</RootNamespace>
65
</PropertyGroup>
76

87
<ItemGroup>
9-
<PackageReference Include="Syncfusion.EJ2.Blazor" Version="17.4.0.49" />
8+
<PackageReference Include="Syncfusion.Blazor" Version="18.1.0.36-beta" />
109
</ItemGroup>
1110

1211
</Project>

Data/WeatherForecast.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22

3-
namespace column_charts.Data
3+
namespace BlazorExample.Data
44
{
55
public class WeatherForecast
66
{

Data/WeatherForecastService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Linq;
33
using System.Threading.Tasks;
44

5-
namespace column_charts.Data
5+
namespace BlazorExample.Data
66
{
77
public class WeatherForecastService
88
{

Pages/FetchData.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@page "/fetchdata"
22

3-
@using column_charts.Data
3+
@using BlazorExample.Data
44
@inject WeatherForecastService ForecastService
55

66
<h1>Weather forecast</h1>

Pages/Index.razor

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
@page "/"
22

3-
<EjsChart Title="Monthly Sales Analysis">
4-
<ChartPrimaryXAxis Title="Month"
5-
ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.Category">
6-
</ChartPrimaryXAxis>
7-
<ChartPrimaryYAxis Title="Sales(Dollars)">
8-
</ChartPrimaryYAxis>
9-
<ChartTooltipSettings Enable="true">
10-
</ChartTooltipSettings>
11-
<ChartLegendSettings Visible="true">
12-
</ChartLegendSettings>
13-
<ChartSeriesCollection>
14-
<ChartSeries DataSource="@Sales" Type="ChartSeriesType.Column"
15-
XName="Month" YName="SalesValue" Name="Sales">
16-
<ChartMarker>
17-
<ChartDataLabel Visible="true" >
18-
</ChartDataLabel>
19-
</ChartMarker>
20-
</ChartSeries>
21-
</ChartSeriesCollection>
22-
</EjsChart>
3+
4+
<SfChart Title="Monthly Sales Analysis">
5+
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category"
6+
Title="Months">
7+
</ChartPrimaryXAxis>
8+
<ChartPrimaryYAxis Title="Sales (Dollars)">
9+
</ChartPrimaryYAxis>
10+
<ChartLegendSettings Visible="true"> </ChartLegendSettings>
11+
<ChartTooltipSettings Enable="true"></ChartTooltipSettings>
12+
<ChartSeriesCollection>
13+
<ChartSeries Type="ChartSeriesType.Column" DataSource="@Sales"
14+
XName="Month" YName="SalesValue" Name="Sales">
15+
<ChartMarker>
16+
<ChartDataLabel Visible="true"> </ChartDataLabel>
17+
</ChartMarker>
18+
</ChartSeries>
19+
</ChartSeriesCollection>
20+
</SfChart>
2321

2422
@code {
25-
public class SalesData {
26-
public string Month;
27-
public double SalesValue;
23+
public class SalesData
24+
{
25+
public string Month { get; set; }
26+
public double SalesValue { get; set; }
2827
}
29-
public List<SalesData> Sales = new List<SalesData>
28+
29+
public List<SalesData> Sales = new List<SalesData>
3030
{
3131
new SalesData { Month = "January", SalesValue = 35 },
3232
new SalesData { Month = "February", SalesValue = 28 },

Pages/_Host.cshtml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@page "/"
2-
@namespace column_charts.Pages
2+
@namespace BlazorExample.Pages
33
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
44
@{
55
Layout = null;
@@ -10,12 +10,10 @@
1010
<head>
1111
<meta charset="utf-8" />
1212
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
13-
<title>column-charts</title>
13+
<title>BlazorExample</title>
1414
<base href="~/" />
1515
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
1616
<link href="css/site.css" rel="stylesheet" />
17-
<script src="https://cdn.syncfusion.com/ej2/17.4.49/dist/ej2.min.js"></script>
18-
<script src="https://cdn.syncfusion.com/ej2/17.4.49/dist/ejs.interop.min.js"></script>
1917
</head>
2018
<body>
2119
<app>

Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using Microsoft.Extensions.Hosting;
1010
using Microsoft.Extensions.Logging;
1111

12-
namespace column_charts
12+
namespace BlazorExample
1313
{
1414
public class Program
1515
{

Properties/launchSettings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"windowsAuthentication": false,
44
"anonymousAuthentication": true,
55
"iisExpress": {
6-
"applicationUrl": "http://localhost:61168",
7-
"sslPort": 44303
6+
"applicationUrl": "http://localhost:55114",
7+
"sslPort": 44378
88
}
99
},
1010
"profiles": {
@@ -15,7 +15,7 @@
1515
"ASPNETCORE_ENVIRONMENT": "Development"
1616
}
1717
},
18-
"column-charts": {
18+
"BlazorExample": {
1919
"commandName": "Project",
2020
"launchBrowser": true,
2121
"applicationUrl": "https://localhost:5001;http://localhost:5000",

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@ Example: https://blazor.syncfusion.com/demos/Charts/Column
77
Documentation: https://ej2.syncfusion.com/blazor/documentation/chart/getting-started
88

99
## Project pre-requisites
10-
Make sure that you have the compatible versions of Visual Studio Code and .NET Core SDK 3.1.1 in your machine before starting to work on this project.
10+
Make sure that you have the compatible versions of Visual Studio 2019 and .NET Core SDK 3.1.2 in your machine before starting to work on this project.
1111

1212
## How to run this application?
13-
To run this application, you need to first clone the `create-blazor-charts-in-a-blazor-server-app` repository and then open it in Visual Studio Code. Now, open the `Integrated Terminal` in VS Code and run the following command to build and run this project.
14-
15-
```
16-
dotnet watch run
17-
```
13+
To run this application, you need to first clone the `create-blazor-charts-in-a-blazor-server-app` repository and then open it in Visual Studio 2019. Now, simply build and run your project to view the output.
1814

1915
Navigate to `http://localhost:5000/` or `http://localhost:5001/` in the browser to view the output.
2016

0 commit comments

Comments
 (0)