Annotation in Angular Progress bar component
20 Sep 20225 minutes to read
Annotation
In the circular progress bar, you can add any view to the center using the Content property in annotation.
For example, you can include add, start, or pause button to control the progress. You can also add an image that indicates the actual task in progress or add custom text that conveys how far the task is completed.
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'my-app',
template:
` <ejs-progressbar id='percentage' type='Circular' trackColor='#FFD939' cornerRadius='Round'
innerRadius='190%' [trackThickness]='trackThickness'
>
<e-progressbar-annotations>
<e-progressbar-annotation
content='<div id="point1" style="font-size:20px;font-weight:bold;color:#ffffff;fill:#ffffff"><span>60%</span></div>'>
</e-progressbar-annotation>
</e-progressbar-annotations>
</ejs-progressbar>`
})
export class AppComponent implements OnInit {
public trackThickness: number;
ngOnInit(): void {
this.trackThickness = 80;
}
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { ProgressBarModule, ProgressAnnotationService } from '@syncfusion/ej2-angular-progressbar';
/**
* Module
*/
@NgModule({
imports: [
BrowserModule, ProgressBarModule
],
declarations: [AppComponent],
bootstrap: [AppComponent],
providers: [ProgressAnnotationService]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);
Label
You can show the progress value in both linear and cicular progress bar using showProgressValue property.
import { Component, OnInit } from '@angular/core';
import { FontModel,AnimationModel, ITextRenderEventArgs } from '@syncfusion/ej2-progressbar';
@Component({
selector: 'my-app',
template:
`<ejs-progressbar id='percentage' type='Linear' [trackThickness]='trackThickness' [progressThickness]='progressThickness' [value]='value' [labelStyle]='labelStyle' (textRender)='textRender2($event)' [showProgressValue]='showProgressValue' [animation]='animation'>
</ejs-progressbar>`
})
export class AppComponent implements OnInit {
public animation: AnimationModel;
public value: number;
public trackThickness: number;
public progressThickness: number;
public labelStyle: FontModel;
public showProgressValue: boolean;
public textRender2(args: ITextRenderEventArgs): void {
args.text = '50';
}
ngOnInit(): void {
this.trackThickness = 24;
this.progressThickness = 24;
this.value = 50;
this.animation = { enable: true, duration: 2000, delay: 0 };
this.labelStyle = { color: '#FFFFFF' };
this.showProgressValue = true;
}
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { ProgressBarModule, ProgressAnnotationService } from '@syncfusion/ej2-angular-progressbar';
/**
* Module
*/
@NgModule({
imports: [
BrowserModule, ProgressBarModule
],
declarations: [AppComponent],
bootstrap: [AppComponent],
providers: [ProgressAnnotationService]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);