Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

<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>
11 changes: 11 additions & 0 deletions BlazorExample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Blazor" Version="18.1.0.58" />
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions Data/WeatherForecast.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace BlazorExample.Data
{
public class WeatherForecast
{
public DateTime Date { get; set; }

public int TemperatureC { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string Summary { get; set; }
}
}
25 changes: 25 additions & 0 deletions Data/WeatherForecastService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Linq;
using System.Threading.Tasks;

namespace BlazorExample.Data
{
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
{
var rng = new Random();
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
}).ToArray());
}
}
}
16 changes: 16 additions & 0 deletions Pages/Counter.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@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++;
}
}
16 changes: 16 additions & 0 deletions Pages/Error.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@page "/error"


<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
46 changes: 46 additions & 0 deletions Pages/FetchData.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@page "/fetchdata"

@using BlazorExample.Data
@inject WeatherForecastService ForecastService

<h1>Weather forecast</h1>

<p>This component demonstrates fetching data from a service.</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 ForecastService.GetForecastAsync(DateTime.Now);
}
}
70 changes: 70 additions & 0 deletions Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@page "/"

<SfSmithchart>
<SmithchartTitle Text="Impedance Transmission"></SmithchartTitle>
<SmithchartLegendSettings Visible="true">
</SmithchartLegendSettings>
<SmithchartSeriesCollection>
<SmithchartSeries Points="PointSeries" Fill="#0F94C4" Name="Tranmission 1">
<SmithchartSeriesMarker Visible="true">
<SmithchartSeriesDatalabel Visible="true">
</SmithchartSeriesDatalabel>
</SmithchartSeriesMarker>
<SmithchartSeriesTooltip Visible="true">
</SmithchartSeriesTooltip>
</SmithchartSeries>
<SmithchartSeries DataSource="@TransmissionSeries" Name="Tranmission 2"
Resistance="Resistancevalue" Reactance="Reactancevalue" Fill="#EE0C88">
<SmithchartSeriesMarker Visible="true">
</SmithchartSeriesMarker>
<SmithchartSeriesTooltip Visible="true">
</SmithchartSeriesTooltip>
</SmithchartSeries>
</SmithchartSeriesCollection>
</SfSmithchart>

@code {

public class ChartData
{
public double Resistancevalue { get; set; }
public double Reactancevalue { get; set; }
}

public List<ChartData> TransmissionSeries = new List<ChartData>
{
new ChartData { Resistancevalue= 10, Reactancevalue= 25 },
new ChartData { Resistancevalue= 8, Reactancevalue= 6 },
new ChartData { Resistancevalue= 6, Reactancevalue= 4.5 },
new ChartData { Resistancevalue= 4.5, Reactancevalue= 2 },
new ChartData { Resistancevalue= 3.5, Reactancevalue= 1.6 },
new ChartData { Resistancevalue= 2.5, Reactancevalue= 1.3 },
new ChartData { Resistancevalue= 2, Reactancevalue= 1.2 },
new ChartData { Resistancevalue= 1.5, Reactancevalue= 1 },
new ChartData { Resistancevalue= 1, Reactancevalue= 0.8 },
new ChartData { Resistancevalue= 0.5, Reactancevalue= 0.4 },
new ChartData { Resistancevalue= 0.3, Reactancevalue= 0.2 },
new ChartData { Resistancevalue= 0.001, Reactancevalue= 0.15 }
};

public List<ISmithChartPoint> PointSeries = new List<ISmithChartPoint>
{
new ISmithChartPoint { Resistance= 20, Reactance= -50 },
new ISmithChartPoint { Resistance= 10, Reactance= -10 },
new ISmithChartPoint { Resistance= 9, Reactance= -4.5 },
new ISmithChartPoint { Resistance= 8, Reactance= -3.5 },
new ISmithChartPoint { Resistance= 7, Reactance= -2.5 },
new ISmithChartPoint { Resistance= 6, Reactance= -1.5 },
new ISmithChartPoint { Resistance= 5, Reactance= -1 },
new ISmithChartPoint { Resistance= 4.5, Reactance= -0.5 },
new ISmithChartPoint { Resistance= 2, Reactance= 0.5 },
new ISmithChartPoint { Resistance= 1.5, Reactance= 0.4 },
new ISmithChartPoint { Resistance= 1, Reactance= 0.4 },
new ISmithChartPoint { Resistance= 0.5, Reactance= 0.2 },
new ISmithChartPoint { Resistance= 0.3, Reactance= 0.1 },
new ISmithChartPoint { Resistance= 0.001, Reactance= 0.05 }
};

}


37 changes: 37 additions & 0 deletions Pages/_Host.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@page "/"
@namespace BlazorExample.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BlazorExample</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="_content/Syncfusion.Blazor/styles/bootstrap4.css" rel="stylesheet" />
</head>
<body>
<app>
<component type="typeof(App)" render-mode="ServerPrerendered" />
</app>

<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>

<script src="_framework/blazor.server.js"></script>
</body>
</html>
28 changes: 28 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace BlazorExample
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
27 changes: 27 additions & 0 deletions Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:64434",
"sslPort": 44372
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BlazorExample": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
# create-blazor-smith-chart-in-a-blazor-application
# Add a Blazor Smith Chart to a Blazor Server App

Learn how easily you can create and configure Syncfusion Blazor Smith Chart in a Blazor server app using Visual Studio 2019. A Blazor Smith Chart is used to visualize the impedance of a transmission line in high-frequency circuit applications. In this video, you will learn how to populate list data, add legends, and enable data labels and tooltips.

Example: https://blazor.syncfusion.com/demos/smith-chart/default-functionalities

Documentation: https://blazor.syncfusion.com/documentation/smith-chart/getting-started

## Project pre-requisites
Make sure that you have the compatible versions of Visual Studio 2019 and .NET Core SDK latest version(3.1.2) in your machine before starting to work on this project.

## How to run this application?
To run this application, you need to first clone the create-blazor-smith-chart-in-a-blazor-application repository and then open it in Visual Studio 2019. Now, simply build and run your project to view the output.

15 changes: 15 additions & 0 deletions Shared/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@inherits LayoutComponentBase

<div class="sidebar">
<NavMenu />
</div>

<div class="main">
<div class="top-row px-4">
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
</div>

<div class="content px-4">
@Body
</div>
</div>
37 changes: 37 additions & 0 deletions Shared/NavMenu.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<div class="top-row pl-4 navbar navbar-dark">
<a class="navbar-brand" href="">BlazorExample</a>
<button class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
</button>
</div>

<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
<ul class="nav flex-column">
<li class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Home
</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="counter">
<span class="oi oi-plus" aria-hidden="true"></span> Counter
</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="fetchdata">
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
</NavLink>
</li>
</ul>
</div>

@code {
private bool collapseNavMenu = true;

private string NavMenuCssClass => collapseNavMenu ? "collapse" : null;

private void ToggleNavMenu()
{
collapseNavMenu = !collapseNavMenu;
}
}
Loading