Smith chart marker in Angular Smithchart component
21 Jul 202619 minutes to read
Markers and Datalabels are used to provide information about the data points in the series. You can add a shape to adorn each data point. By default marker and datalabel both are disabled in smithchart. You can enable both of them by setting visible property as true in marker and datalabel settings
Enable markers in the Smith Chart
Use the series marker property to configure series markers. To display a marker for a particular series, set visible to true on the marker’s options. The following sample enables the marker for the first series only.
Update app.component.ts to bind a marker object to the first series.
import { Component } from '@angular/core';
import { SmithchartModule, TooltipRenderService, SmithchartLegendService } from '@syncfusion/ej2-angular-charts';
@Component({
imports: [SmithchartModule],
providers: [TooltipRenderService, SmithchartLegendService],
standalone: true,
selector: 'app-container',
template: `<ejs-smithchart style='display: block;' id='container' [title]='title' height='350px'>
<e-seriesCollection>
<e-series [marker]='marker' [dataSource]='seriesdata1' name='Transmission1' reactance='reactance' resistance='resistance'></e-series>
<e-series [points]='seriespoints' name='Transmission2'></e-series>
</e-seriesCollection>
</ejs-smithchart>`
})
export class AppComponent {
public title: object = { text: 'Transmission lines applied for both impedance and admittance' };
public marker: object = {
visible: true
};
public seriesdata1: object[] = [
{ resistance: 0, reactance: 0.05 }, { resistance: 0, reactance: 0.05 },
{ resistance: 0, reactance: 0.05 }, { resistance: 0, reactance: 0.05 },
{ resistance: 0, reactance: 0.05 }, { resistance: 0, reactance: 0.05 },
{ resistance: 0, reactance: 0.05 }, { resistance: 0, reactance: 0.05 },
{ resistance: 0, reactance: 0.05 }, { resistance: 0, reactance: 0.05 },
{ resistance: 0.3, reactance: 0.1 }, { resistance: 0.5, reactance: 0.2 },
{ resistance: 1.5, reactance: 0.5 }, { resistance: 2.0, reactance: 0.5 },
{ resistance: 2.5, reactance: 0.4 }, { resistance: 3.5, reactance: 0.0 },
{ resistance: 2.5, reactance: 0.4 }, { resistance: 3.5, reactance: 0.0 },
{ resistance: 2.5, reactance: 0.4 }, { resistance: 3.5, reactance: 0.0 },
{ resistance: 4.5, reactance: -0.5 }, { resistance: 5.0, reactance: -1.0 }
];
public seriespoints: object[] = [
{ resistance: 0, reactance: 0.15 }, { resistance: 0, reactance: 0.15 },
{ resistance: 0, reactance: 0.15 }, { resistance: 0.3, reactance: 0.2 },
{ resistance: 0.3, reactance: 0.2 }, { resistance: 0.3, reactance: 0.2 },
{ resistance: 0.3, reactance: 0.2 }, { resistance: 0.3, reactance: 0.2 },
{ resistance: 0.5, reactance: 0.4 }, { resistance: 1.0, reactance: 0.8 },
{ resistance: 2.5, reactance: 1.3 }, { resistance: 3.5, reactance: 1.6 },
{ resistance: 3.5, reactance: 1.6 }, { resistance: 3.5, reactance: 1.6 },
{ resistance: 4.5, reactance: 2.0 }, { resistance: 6.0, reactance: 4.5 },
{ resistance: 8, reactance: 6 }, { resistance: 10, reactance: 25 }
];
}import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));Marker Customization
Using marker settings in series, you can customize the marker for each series differently. Using marker settings, you can customize following properties differently for each series in the smithchart.
- [
width] - To control the width of the marker. - [
height] - To control the height of the marker. - [
fill] - Used to customize the fill color of the marker. - [
opacity] - Used to customize the opacity of the marker. - [
border] - Used to control the width and color of the marker’s border. - [
shape] - Used to change the shape of the marker.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { SmithchartModule, TooltipRenderService, SmithchartLegendService } from '@syncfusion/ej2-angular-charts'
import { Component } from '@angular/core';
@Component({
imports: [
SmithchartModule
],
providers: [TooltipRenderService, SmithchartLegendService],
standalone: true,
selector: 'app-container',
template: `<ejs-smithchart style='display: block;' id='container' >
<e-seriesCollection>
<e-series [marker] ='marker' [dataSource]='seriesdata1' name ='Transmission1' reactance='reactance' resistance='resistance'> </e-series>
</e-seriesCollection>
</ejs-smithchart>`
})
export class AppComponent {
public marker:object = {
visible: true,
height: 10,
width: 10,
fill: '#ff99ff',
opacity: 1,
shape: 'rectangle',
border: {
color: '#cc00cc',
width: 2
}
}
public seriesdata1: 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 },
];
}import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));Enable data labels on Smith Chart markers
Use the marker dataLabel property to configure marker data labels. To display a data label for a particular series marker, set visible to true on the marker’s dataLabel options. The following sample enables data labels for the first series.
Update app.component.ts as shown in the following example.
import { Component } from '@angular/core';
import { SmithchartModule, TooltipRenderService, SmithchartLegendService } from '@syncfusion/ej2-angular-charts';
@Component({
imports: [SmithchartModule],
providers: [TooltipRenderService, SmithchartLegendService],
standalone: true,
selector: 'app-container',
template: `<ejs-smithchart style='display: block;' id='container' [title]='title' height='350px'>
<e-seriesCollection>
<e-series [marker]='marker' [dataSource]='seriesdata1' name='Transmission1' reactance='reactance' resistance='resistance'></e-series>
<e-series [points]='seriespoints' name='Transmission2'></e-series>
</e-seriesCollection>
</ejs-smithchart>`
})
export class AppComponent {
public title: object = { text: 'Transmission lines applied for both impedance and admittance' };
public marker: object = {
visible: true,
dataLabel: {
visible: true
}
};
public seriesdata1: object[] = [
{ resistance: 0, reactance: 0.05 }, { resistance: 0, reactance: 0.05 },
{ resistance: 0, reactance: 0.05 }, { resistance: 0, reactance: 0.05 },
{ resistance: 0, reactance: 0.05 }, { resistance: 0, reactance: 0.05 },
{ resistance: 0, reactance: 0.05 }, { resistance: 0, reactance: 0.05 },
{ resistance: 0, reactance: 0.05 }, { resistance: 0, reactance: 0.05 },
{ resistance: 0.3, reactance: 0.1 }, { resistance: 0.5, reactance: 0.2 },
{ resistance: 1.5, reactance: 0.5 }, { resistance: 2.0, reactance: 0.5 },
{ resistance: 2.5, reactance: 0.4 }, { resistance: 3.5, reactance: 0.0 },
{ resistance: 2.5, reactance: 0.4 }, { resistance: 3.5, reactance: 0.0 },
{ resistance: 2.5, reactance: 0.4 }, { resistance: 3.5, reactance: 0.0 },
{ resistance: 4.5, reactance: -0.5 }, { resistance: 5.0, reactance: -1.0 }
];
public seriespoints: object[] = [
{ resistance: 0, reactance: 0.15 }, { resistance: 0, reactance: 0.15 },
{ resistance: 0, reactance: 0.15 }, { resistance: 0.3, reactance: 0.2 },
{ resistance: 0.3, reactance: 0.2 }, { resistance: 0.3, reactance: 0.2 },
{ resistance: 0.3, reactance: 0.2 }, { resistance: 0.3, reactance: 0.2 },
{ resistance: 0.5, reactance: 0.4 }, { resistance: 1.0, reactance: 0.8 },
{ resistance: 2.5, reactance: 1.3 }, { resistance: 3.5, reactance: 1.6 },
{ resistance: 3.5, reactance: 1.6 }, { resistance: 3.5, reactance: 1.6 },
{ resistance: 4.5, reactance: 2.0 }, { resistance: 6.0, reactance: 4.5 },
{ resistance: 8, reactance: 6 }, { resistance: 10, reactance: 25 }
];
}import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));Datalabel customization
Using datalabel settings in marker, you can customize the datalabel for each series differently. In datalabel, you can customize the following properties differently for each series.
- [
fill] - Used to changes the fill color of the data label’s shape. - [
opacity] - Used to control the opacity of the data label’s shape. - [
border] - Used to customize the width and color of the border. - [
textStyle] - Used to customize the font color, width and size.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { SmithchartModule, TooltipRenderService, SmithchartLegendService } from '@syncfusion/ej2-angular-charts'
import { Component } from '@angular/core';
@Component({
imports: [
SmithchartModule
],
providers: [TooltipRenderService, SmithchartLegendService],
standalone: true,
selector: 'app-container',
template: `<ejs-smithchart style='display: block;' id='container' >
<e-seriesCollection>
<e-series [marker] ='marker' [dataSource]='seriesdata1' name ='Transmission1' reactance='reactance' resistance='resistance'> </e-series>
</e-seriesCollection>
</ejs-smithchart>`
})
export class AppComponent {
public marker:object = {
dataLabel: {
visible: true,
fill: '#99ffcc',
opacity: 1,
border: {
color: '#1aff8c',
width: 2,
}
}
};
public seriesdata1: 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 },
];
}import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));