Having trouble getting help?
Contact Support
Contact Support
Data binding in Angular Bullet chart component
27 Apr 20244 minutes to read
Bullet Chart can visualise data bound from local or remote data.
Local Data
The dataSource
property accepts a collection of values as input that helps to display measures, and compares them to a target bar. To display the actual and target bar, specify the property from the datasource into the valueField
and targetField
respectively.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { BulletChartModule} from '@syncfusion/ej2-angular-charts'
import { Component } from '@angular/core';
import { AnimationModel } from '@syncfusion/ej2-charts';
@Component({
imports: [
BulletChartModule
],
providers: [ ],
standalone: true,
selector: 'app-container',
template: `<ejs-bulletchart id='localData' valueField='completedStories' targetField='requiredStories'
category='name' height='400px' [minimum]='minimum' [maximum]='maximum' [interval]='interval'
title='Sprint Planning' titlePosition='Top' [dataSource]='data' [animation]='animation'>
<e-bullet-range-collection>
<e-bullet-range end='25' color='#ebebeb'></e-bullet-range>
<e-bullet-range end='37' color='#d8d8d8'></e-bullet-range>
<e-bullet-range end='45' color='#7f7f7f'></e-bullet-range>
</e-bullet-range-collection>
</ejs-bulletchart>`
})
export class AppComponent {
public minimum: number = 5;
public maximum: number = 45;
public interval: number = 5;
public animation: AnimationModel = { enable: false }
public data: Object[] = [
{
requiredStories: 20,
completedStories: 25,
name: 'David'
},
{
requiredStories: 25,
completedStories: 20,
name: 'Asif'
},
{
requiredStories: 15,
completedStories: 10,
name: 'Thomas'
},
{
requiredStories: 40,
completedStories: 39,
name: 'Rohit'
},
{
requiredStories: 35,
completedStories: 40,
name: 'Virat'
},
{
requiredStories: 28,
completedStories: 25,
name: 'Jude'
},
{
requiredStories: 10,
completedStories: 18,
name: 'Warner'
},
{
requiredStories: 30,
completedStories: 28,
name: 'Malik'
}
];
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));