Annotation in EJ2 JavaScript Progress Bar control
4 Sep 20265 minutes to read
Annotation
In the circular Progress Bar, any view can be added 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.
var linearProgress1 = new ej.progressbar.ProgressBar({
type: "Circular",
innerRadius: "190%",
trackThickness: 80,
cornerRadius: "Round",
trackColor: "#FFD939",
annotations: [
{
content:
'<div id="point1" style="font-size:20px;font-weight:bold;color:#ffffff;fill:#ffffff"><span>60%</span></div>'
}
]
});
linearProgress1.appendTo('#percentage');<!DOCTYPE html><html lang="en"><head>
<title>Essential JS 2 Toast</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Typescript Toolbar Controls">
<meta name="author" content="Syncfusion">
<link href="index.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/34.2.2/material.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/34.2.2/dist/ej2.min.js" type="text/javascript"></script>
</head>
<body>
<div id="container">
<div class="row linear-parent">
<div id="percentage"></div>
</div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>Label
The progress value can be shown in both linear and circular Progress Bar using showProgressValue property.
var linearProgress1 = new ej.progressbar.ProgressBar({
type: 'Linear',
trackThickness: 24,
progressThickness: 24,
value: 50,
showProgressValue: true,
labelStyle: {
color: '#FFFFFF'
},
animation: {
enable: true,
duration: 2000,
delay: 0,
},
textRender: (args) => {
args.text = '50';
}
});
linearProgress1.appendTo('#percentage');<!DOCTYPE html><html lang="en"><head>
<title>Essential JS 2 Toast</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Typescript Toolbar Controls">
<meta name="author" content="Syncfusion">
<link href="index.css" rel="stylesheet">
<link href="https://cdn.syncfusion.com/ej2/34.2.2/material.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/34.2.2/dist/ej2.min.js" type="text/javascript"></script>
</head>
<body>
<div id="container">
<div class="row linear-parent">
<div id="percentage"></div>
</div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>