Getting Started with WPF Smith Chart control

18 Nov 201819 minutes to read

This section explains the steps required to build the application with WPF Smith Chart.

Steps

  1. Create a new WPF project using Visual Studio. For more details.
  2. Add the WPF Smith Chart assembly to your application.
  3. Initialize the smith chart control.
  4. Add a header to the smith chart control.
  5. Add series to the smith chart control.
  6. Add legends for the series.

These steps are explained below in both XAML and code behind.

Create a simple smith chart from XAML

Adding assembly reference

  1. Open the Add Reference window in your project.
  2. Choose Windows > Extensions > Syncfusion.SfSmithChart.WPF.

Reference Manager Dialog Windows in Visual Studio

  1. Select the .NET Framework version with respect to your application. The version can be identified as below:
XX.X450.0.X 4.5 Framework
XX.X451.0.X 4.5.1 Framework
XX.X460.0.X 4.6 Framework
  1. Add the following namespace in your XAML window.

  2. XAML
  3. xmlns:syncfusion="clr-namespace:Syncfusion.UI.Xaml.SmithChart;assembly=Syncfusion.SfSmithChart.WPF"

Add WPF Smith Chart from Toolbox

Drag and drop the SfSmithChart control from the Toolbox into your application.

Visual Studio Toolbox

Now, the Syncfusion.SfSmithChart.WPF reference has been added to the application references and the xmlns namespace code has been generated in MainWindow.xaml as below.

Project Solution Window contains SfSmithChart reference

Added namespace for SfSmithChart control in MainWindow

In this section, the data in the following table is used for demonstration.

Impedance Transmission of SmithChart

Resistance Reactance
0 0.05
0.3 0.1
0.5 0.2
1.0 0.4
1.5 0.5
2.0 0.5
2.5 0.4
3.5 0.0
4.5 -0.5
5.0 -1.0
6.0 -1.5
7.0 -2.5
8.0 -3.5
9.0 -4.5
10 -10
20 -50

Before proceeding with the smith chart, create a data model with the above details as follows.

  • C#
  • public class TransmissionData
        {
            public double Resistance { get; set; }
    
            public double Reactance { get; set; }
        }

    Create a collection property in the MainWindow class as below:

  • C#
  • public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
            }
    
            public ObservableCollection<TransmissionData> Data { get; set; } 
        }

    Add the values to this Data property with the values illustrated in the above table.

  • C#
  • public MainWindow()
        { 
            InitializeComponent();
    
            Data = new ObservableCollection<TransmissionData>();
    
            Data.Add(new TransmissionData() { Resistance = 0, Reactance = 0.05 });
            Data.Add(new TransmissionData() { Resistance = 0.3, Reactance = 0.1 });
            Data.Add(new TransmissionData() { Resistance = 0.5, Reactance = 0.2 });
            Data.Add(new TransmissionData() { Resistance = 1.0, Reactance = 0.4 });
            Data.Add(new TransmissionData() { Resistance = 1.5, Reactance = 0.5 });
            Data.Add(new TransmissionData() { Resistance = 2.0, Reactance = 0.5 });
            Data.Add(new TransmissionData() { Resistance = 2.5, Reactance = 0.4 });
            Data.Add(new TransmissionData() { Resistance = 3.5, Reactance = 0.0 });
            Data.Add(new TransmissionData() { Resistance = 4.5, Reactance = -0.5 });
            Data.Add(new TransmissionData() { Resistance = 5, Reactance = -1.0 });
            Data.Add(new TransmissionData() { Resistance = 6, Reactance = -1.5 });
            Data.Add(new TransmissionData() { Resistance = 7, Reactance = -2.5 });
            Data.Add(new TransmissionData() { Resistance = 8, Reactance = -3.5 });
            Data.Add(new TransmissionData() { Resistance = 9, Reactance = -4.5 });
            Data.Add(new TransmissionData() { Resistance = 10, Reactance = -10 });
            Data.Add(new TransmissionData() { Resistance = 20, Reactance = -50 });
        }

    Initialize the smith chart

    To initialize the smith chart, use the following class Syncfusion.UI.Xaml.SmithChart.SfSmithChart.

  • XAML
  • <syncfusion:SfSmithChart>
    
    </syncfusion:SfSmithChart>

    SmithChart with default axes

    Add a header to the smith chart

    The header of the smith chart acts as the title and it is used to identify the purpose of the smith chart.

    Specify Impedance Transmission as header in the below code example.

  • XAML
  • <Grid>
    
            <syncfusion:SfSmithChart Header="Impedance Transmission" Height="400" Width="500">
                
            </syncfusion:SfSmithChart>
    
        </Grid>

    Adding Axes

    The following code example illustrates how to add and customize the resistance (Horizontal) and reactance (Radial) axes in the WPF Smith Chart.

  • XAML
  • <syncfusion:SfSmithChart.HorizontalAxis>
            <syncfusion:HorizontalAxis FontSize="11" FontFamily="Segoe UI"></syncfusion:HorizontalAxis>
        </syncfusion:SfSmithChart.HorizontalAxis>
        <syncfusion:SfSmithChart.RadialAxis>
            <syncfusion:RadialAxis FontSize="11" FontFamily="Segoe UI"></syncfusion:RadialAxis>
        </syncfusion:SfSmithChart.RadialAxis>

    SmithChart with header and axis customization

    Adding series

    You can plot a line on the smith chart by adding a line series.

    Initialize the series for representing the Transmission Data.

  • XAML