I have designed an angular circular progress bar, but I am facing an issue with making the percentage value dynamic. I have managed to retrieve the dynamic value from an API, but I am unsure of how to implement it in creating a circular progress bar using SVG. Below is the HTML skeleton and CSS that I am currently using:
.track,
.filled {
stroke-width: 10;
fill: none;
}
.track {
stroke: rgba(160, 215, 231, 0.85);
}
.filled {
stroke: blue;
stroke-dashoffset: 202;
stroke-dasharray: 440;
}
<div class="col-lg-3"> <div class="iconbox-singleD7 dashboard-height"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="-35 0 190 190" class="mw"> <circle class="track" cx="60" cy="60" r="55" /> <text x="40" y="60" fill="#fff">Patients</text> <text x="50" y="75" fill="#fff">{{totalPatient}}</text> <circle class="filled" cx="60" cy="60" r="55" /> <circle cx="30" cy="136" r="5" stroke="blue" stroke-width="3" fill="blue" /><text x="40" y="140" fill="#fff">Male {{malePercentage}}%</text> <circle cx="30" cy="152" r="5" stroke="rgba(160, 215, 231, 0.85)" stroke-width="3" fill="rgba(160, 215, 231, 0.85)" /><text x="40" y="155" fill="#fff">Female {{femalePercentage}}%</text> </svg> </div> </div>
My goal is to dynamically set the progress bar based on the percentage retrieved from the API, for example, if I get a male percentage of 70%, I want the progress bar to reflect that value. As I am not familiar with SVG, any help or guidance on achieving this would be greatly appreciated. Thank you.