Contents
- setPointerValue
- setAnnotationValue
- refresh
Having trouble getting help?
Contact Support
Contact Support
Methods in Angular Linear gauge component
27 Apr 20247 minutes to read
The following methods are available in the Linear Gauge component.
setPointerValue
To change the pointer value dynamically, use the setPointerValue
method in the Linear Gauge component. The following are the arguments for this method.
Argument name | Description |
---|---|
axisIndex | Specifies the index of the axis in which the pointer value is to be updated. |
pointerIndex | Specifies the index of the pointer to be updated. |
pointerValue | Specifies the value of the pointer to be updated. |
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { LinearGaugeModule } from '@syncfusion/ej2-angular-lineargauge'
import { GaugeTooltipService } from '@syncfusion/ej2-angular-lineargauge'
import { Component, ViewChild } from '@angular/core';
import { LinearGaugeComponent } from '@syncfusion/ej2-angular-lineargauge';
@Component({
imports: [
LinearGaugeModule
],
providers: [ GaugeTooltipService ],
standalone: true,
selector: 'app-container',
template: `
<div> <button id='btn' (click)='clicked()'>Click</button></div>
<ejs-lineargauge id="gauge-container" #gauge>
<e-axes>
<e-axis>
<e-pointers>
<e-pointer value=80></e-pointer>
</e-pointers>
</e-axis>
</e-axes>
</ejs-lineargauge>`
})
export class AppComponent {
@ViewChild('gauge')
public gaugeObj: LinearGaugeComponent| any;
clicked() {
this.gaugeObj.setPointerValue(0, 0, 30);
};
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
setAnnotationValue
To change the annotation content dynamically, use the setAnnotationValue
method in the Linear Gauge component. The following are the arguments for this method.
Argument name | Description |
---|---|
annotationIndex | Specifies the index number of the annotation to be updated. |
content | Specifies the text for the annotation to be updated. |
axisValue | Specifies the value of the axis where the annotation is to be placed. |
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { LinearGaugeModule } from '@syncfusion/ej2-angular-lineargauge'
import { GaugeTooltipService } from '@syncfusion/ej2-angular-lineargauge'
import { Component, ViewChild } from '@angular/core';
import { AnnotationsService, LinearGaugeComponent } from '@syncfusion/ej2-angular-lineargauge';
@Component({
imports: [
LinearGaugeModule
],
providers: [ GaugeTooltipService ],
standalone: true,
selector: 'app-container',
template: `
<div> <button id='btn' (click)='clicked()'>Click</button></div>
<ejs-lineargauge id="gauge-container" #gauge>
<e-annotations>
<e-annotation zIndex='1' content='10' axisValue=0></e-annotation>
</e-annotations>
<e-axes>
<e-axis>
<e-pointers>
<e-pointer value=10></e-pointer>
</e-pointers>
</e-axis>
</e-axes>
</ejs-lineargauge>`,
providers: [AnnotationsService]
})
export class AppComponent {
@ViewChild('gauge')
public gaugeObj: LinearGaugeComponent | any;
clicked() {
this.gaugeObj.setAnnotationValue(0, '50', 50);
};
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
refresh
The refresh
method can be used to change the state of the component and render it again.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { LinearGaugeModule } from '@syncfusion/ej2-angular-lineargauge'
import { GaugeTooltipService } from '@syncfusion/ej2-angular-lineargauge'
import { Component, ViewChild } from '@angular/core';
import { LinearGaugeComponent } from '@syncfusion/ej2-angular-lineargauge';
@Component({
imports: [
LinearGaugeModule
],
providers: [ GaugeTooltipService ],
standalone: true,
selector: 'app-container',
template: `
<div> <button id='btn' (click)='clicked()'>Click</button></div>
<ejs-lineargauge id="gauge-container" #gauge>
<e-axes>
<e-axis>
<e-pointers>
<e-pointer value=10></e-pointer>
</e-pointers>
</e-axis>
</e-axes>
</ejs-lineargauge>`
})
export class AppComponent {
@ViewChild('gauge')
public gaugeObj : LinearGaugeComponent | any;
clicked() {
this.gaugeObj.refresh();
};
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));