The title of the Bullet Chart displays the information about the data plotted by specifying it in the title
property.
import { BulletChart, BulletTooltip } from '@syncfusion/ej2-charts';
BulletChart.Inject(BulletTooltip);
let chart: BulletChart = new BulletChart({
title: 'Sales Rate',
dataSource: [
{ value: 55, target: 75, category: 'Year 1' },
],
animation: { enable: false },
valueField: 'value',
ranges: [ { end: 35 },
{ end: 50 },
{ end: 100 }
],
minimum: 0, maximum: 100, interval: 20
}, '#element');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>
To show additional information about the data plotted, the Bullet Chart can also be given a subtitle using the subtitle
property.
import { BulletChart, BulletTooltip } from '@syncfusion/ej2-charts';
BulletChart.Inject(BulletTooltip);
let chart: BulletChart = new BulletChart({
title: 'Sales Rate in dollars',
subtitle: '(in dollars $)',
dataSource: [
{ value: 55, target: 45, category: 'Year 1' },
],
animation: { enable: false },
targetField: 'target',
valueField: 'value',
labelFormat: '${value}',
ranges: [ { end: 35 },
{ end: 50 },
{ end: 100 }
],
minimum: 0, maximum: 100, interval: 20
}, '#element');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>
The title and the subtitle positions can be customized using the titlePosition
property. Possible positions are Left, Right, Top, and Bottom.
By setting the titlePosition
to Left, you can display the title and subtitle at the left side of the Bullet Chart.
import { BulletChart, BulletTooltip } from '@syncfusion/ej2-charts';
BulletChart.Inject(BulletTooltip);
let chart: BulletChart = new BulletChart({
title: 'Sales Rate',
subtitle: '(in dollars $)',
dataSource: [
{ value: 55, target: 45, category: 'Year 1' },
],
animation: { enable: false },
targetField: 'target',
valueField: 'value',
titlePosition: 'Left',
labelFormat: '${value}',
ranges: [ { end: 35 },
{ end: 50 },
{ end: 100 }
],
minimum: 0, maximum: 100, interval: 20
}, '#element');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>
By setting the titlePosition
to Right, you can display the title and subtitle at the right side of the Bullet Chart.
import { BulletChart, BulletTooltip } from '@syncfusion/ej2-charts';
BulletChart.Inject(BulletTooltip);
let chart: BulletChart = new BulletChart({
title: 'Sales Rate',
subtitle: '(in dollars $)',
dataSource: [
{ value: 55, target: 45, category: 'Year 1' },
],
animation: { enable: false },
targetField: 'target',
valueField: 'value',
titlePosition: 'Right',
labelFormat: '${value}',
ranges: [ { end: 35 },
{ end: 50 },
{ end: 100 }
],
minimum: 0, maximum: 100, interval: 20
}, '#element');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>
By setting the titlePosition
to Top, you can display the title and subtitle at the top of the Bullet Chart. The default title and subtitle positions of the Bullet Chart is Top.
import { BulletChart, BulletTooltip } from '@syncfusion/ej2-charts';
BulletChart.Inject(BulletTooltip);
let chart: BulletChart = new BulletChart({
title: 'Sales Rate',
subtitle: '(in dollars $)',
dataSource: [
{ value: 55, target: 45, category: 'Year 1' },
],
animation: { enable: false },
targetField: 'target',
valueField: 'value',
titlePosition: 'Top',
labelFormat: '${value}',
ranges: [ { end: 35 },
{ end: 50 },
{ end: 100 }
],
minimum: 0, maximum: 100, interval: 20
}, '#element');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>
By setting the titlePosition
to Bottom, you can display the title and subtitle at the bottom of the Bullet Chart.
import { BulletChart, BulletTooltip } from '@syncfusion/ej2-charts';
BulletChart.Inject(BulletTooltip);
let chart: BulletChart = new BulletChart({
title: 'Sales Rate',
subtitle: '(in dollars $)',
dataSource: [
{ value: 55, target: 45, category: 'Year 1' },
],
animation: { enable: false },
targetField: 'target',
valueField: 'value',
titlePosition: 'Bottom',
labelFormat: '${value}',
ranges: [ { end: 35 },
{ end: 50 },
{ end: 100 }
],
minimum: 0, maximum: 100, interval: 20
}, '#element');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>
The title color, opacity, font size, font family, font weight, and font style can be customized using the titleStyle
property.
import { BulletChart, BulletTooltip } from '@syncfusion/ej2-charts';
BulletChart.Inject(BulletTooltip);
let chart: BulletChart = new BulletChart({
title: 'Sales Rate',
dataSource: [
{ value: 55, target: 45, category: 'Year 1' },
],
animation: { enable: false },
targetField: 'target',
valueField: 'value',
labelFormat: '${value}',
titleStyle: { size: '22px', color: 'red', fontFamily: 'cursive', fontWeight: 'Bold'},
ranges: [ { end: 35 },
{ end: 50 },
{ end: 100 }
],
minimum: 0, maximum: 100, interval: 20
}, '#element');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>
The sub-title color, opacity, font size, font family, font weight, and font style can be customized using the subtitleStyle
property.
import { BulletChart, BulletTooltip } from '@syncfusion/ej2-charts';
BulletChart.Inject(BulletTooltip);
let chart: BulletChart = new BulletChart({
title: 'Sales Rate',
dataSource: [
{ value: 55, target: 45, category: 'Year 1' },
],
animation: { enable: false },
targetField: 'target',
valueField: 'value',
labelFormat: '${value}',
subtitleStyle: { size: '22px', color: 'red', fontFamily: 'cursive', fontWeight: 'Bold'},
ranges: [ { end: 35 },
{ end: 50 },
{ end: 100 }
],
minimum: 0, maximum: 100, interval: 20
}, '#element');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 Animation</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id='loader'>Loading....</div>
<div id='container'>
<div id='element'></div>
</div>
</body>
</html>