Ranges in Angular Bullet chart component
27 Apr 20244 minutes to read
Ranges represent the quality of a specific range such as Good, Bad and Satisfactory in the Bullet Chart scale. The ending point of a qualitative range is specified in the end
property in ranges
. The minimum
value of a quantitative scale is considered the starting point of the first range or the previous range end point.
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 targetField='target' valueField='value' categoryField='category' [minimum]='minimum' [maximum]='maximum'
[interval]='interval' [dataSource]='data' [animation]='animation' height='400' [categoryLabelStyle]='categoryLabelStyle'
title='Sales Rate'>
<e-bullet-range-collection>
<e-bullet-range end='35' color='#ebebeb'></e-bullet-range>
<e-bullet-range end='70' color='#d8d8d8'></e-bullet-range>
<e-bullet-range end='100' color='#7f7f7f'></e-bullet-range>
</e-bullet-range-collection>
</ejs-bulletchart>`
})
export class AppComponent {
public minimum: number = 0;
public maximum: number = 100;
public interval: number = 20;
public data: Object[] = [
{ value: 55, target: 75, category: 'Year 1' },
{ value: 70, target: 70, category: 'Year 2' },
{ value: 85, target: 75, category: 'Year 3' }
];
public animation: AnimationModel = { enable: false };
public categoryLabelStyle: Object = { color: 'red', size: '13', fontWeight: 'bold'};
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));
Color Customization
Enhance the readability of ranges with color and opacity. It can be applied using the color
and opacity
properties in ranges
.
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 targetField='target' valueField='value' categoryField='category' [minimum]='minimum' [maximum]='maximum'
[interval]='interval' [dataSource]='data' [animation]='animation' height='400' [categoryLabelStyle]='categoryLabelStyle'
title='Sales Rate'>
<e-bullet-range-collection>
<e-bullet-range end='35' color='darkred'></e-bullet-range>
<e-bullet-range end='50' color='red'></e-bullet-range>
<e-bullet-range end='75' color='blue'></e-bullet-range>
<e-bullet-range end='90' color='lightgreen'></e-bullet-range>
<e-bullet-range end='100' color='green'></e-bullet-range>
</e-bullet-range-collection>
</ejs-bulletchart>`
})
export class AppComponent {
public minimum: number = 0;
public maximum: number = 100;
public interval: number = 20;
public data: Object[] = [
{ value: 55, target: 75, category: 'Year 1' },
{ value: 70, target: 70, category: 'Year 2' },
{ value: 85, target: 75, category: 'Year 3' }
];
public animation: AnimationModel = { enable: false };
public categoryLabelStyle: Object = { color: 'red', size: '13', fontWeight: 'bold'};
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));