Articles in this section
Category / Section

How to get started easily with Syncfusion Angular 11 Smith Chart?

3 mins read

The Essential JS 2 Smith Chart is a graphical tool used to solve transmission line problems. This KB article explains how to easily integrate Syncfusion Angular Smith Chart in an Angular 11 application and how to enable its commonly used features using services.

Prerequisites

 

Before starting, you need the following items to create Angular Smith Chart in an Angular 11 Application:

 

Installation and application creation

 

  1. Install Angular CLI using the following command.

 

npm install @angular/cli@11.2.3

 

Note:

If you would like to follow and run the application in Angular6 or Angular 5 or Angular 4, You need to replace the CLI command version  number with corresponding Angular version number

 

npm install -g @angular/cli@<CLI VERSION>

 

 

  1. Create an Angular 11 application using Angular CLI.

 

ng new angular11-app

cd angular11-app

 

  1. Serve the Angular 11 application using the following command.

 

ng serve --open

 

Listen to the application in localhost:4200. Your application will serve in browser. Refer to the following screenshot for Angular 11 version.

Angular_app

 

Integration of Angular Smith Chart

 

  1. After running the Angular 11 application successfully, configure the Angular charts in this application. Install Angular charts and EJ2 package using the following command.
    npm install @syncfusion/ej2-angular-charts --save
    
    npm install @syncfusion/ej2 --save
    
    

 

The –save command instructs the NPM to include the Smith Chart package inside the dependencies section of the package.json.

  1. Import SmithchartModule from installed package in app/app.module.ts.

 

import { BrowserModule } from '@angular/platform-browser';

import { NgModule } from '@angular/core';

import {SmithChartModule } from '@syncfusion/ej2-angular-charts;

import { AppComponent } from './app.component';

@NgModule ({

    declarations: [

        AppComponent

     ],

    imports: [

       BrowserModule,

       SmithchartModule

     ],

    providers: [],

    bootstrap: [AppComponent]

 })

export class AppModule { }

  1. Refer the CSS file for Angular Smith Chart in style.css.

 

Import “../node_modules/@syncfusion/ej2/material.css”

 

  1. Add the Angular Smith Chart component in app.component.html.

 

<ejs-smithchart> </ejs-smithchart>

 

  1. Now, add the data source for this Smith Chart in app.component.ts.

 

export class AppComponent {

    title = 'angularsmithchart-app';

    public data: Object[] = [

        { resistance: 10, reactance: 25 }, { resistance: 8, reactance: 6 },

        { resistance: 6, reactance: 4.5 }, { resistance: 4.5, reactance: 2 },

        { resistance: 3.5, reactance: 1.6 }, { resistance: 2.5, reactance: 1.3 },

        { resistance: 2, reactance: 1.2 }, { resistance: 1.5, reactance: 1 },

        { resistance: 1, reactance: 0.8 }, { resistance: 0.5, reactance: 0.4 },

        { resistance: 0.3, reactance: 0.2 }, { resistance: 0, reactance: 0.15 }

     ];

 public data1: Object[] = [

        { resistance: 20, reactance: -50 }, { resistance: 10, reactance: -10 },

        { resistance: 9, reactance: -4.5 }, { resistance: 8, reactance: -3.5 },

        { resistance: 7, reactance: -2.5 }, { resistance: 6, reactance: -1.5 },

        { resistance: 5, reactance: -1 }, { resistance: 4.5, reactance: -0.5 },

        { resistance: 3.5, reactance: 0 }, { resistance: 2.5, reactance: 0.4 },

        { resistance: 2, reactance: 0.5 }, { resistance: 1.5, reactance: 0.5 },

        { resistance: 1, reactance: 0.4 }, { resistance: 0.5, reactance: 0.2 },

        { resistance: 0.3, reactance: 0.1 }, { resistance: 0, reactance: 0.05 }

    ]; 

}

 

  1. After adding the datasource, define the Smith Chart in app.component.html.

 

<ejs-smithchart  id='smithchartcontainer' >

    <e-seriesCollection>

        <e-series [points]='data' name='Transmission1'      [enableAnimation] = true > </e-series>

        <e-series [points]='data1' name='Transmission2'[enableAnimation] =true> </e-series>

    </e-seriesCollection>

</ejs-smithchart>

 

  1. Now, serve the application using the following command.

 

ng serve --open

After all the files have been compiled successfully, it will serve the site at localhost:4200.

The following screenshot illustrates Smith Chart.

smithChart

Summary

 

To know more about the Smith Chart, check our Angular Smith Chart features from this page. If you have any queries or require clarifications. Please let us know in comments below. You can also contact us through our Support forum or Direct-Trac. We are happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied