Я пытаюсь построить круговую диаграмму в процентах следующим образом:
На данный момент у меня есть это: https://jsfiddle.net/pvtxgq21/1/
HTML:
<svg viewBox="0 0 36 36" class="circular-chart">
<path
class="circle-outer"
d="M18 2.0845
a 15.9155 15.9155 0 0 1 0 31.831
a 15.9155 15.9155 0 0 1 0 -31.831"
/>
<path
class="circle"
stroke-dasharray="50, 100"
d="M18 2.0845
a 15.9155 15.9155 0 0 1 0 31.831
a 15.9155 15.9155 0 0 1 0 -31.831"
/>
</svg>
CSS:
body {
background-color: #000;
}
.circular-chart {
display: block;
margin: 10px auto;
max-width: 256px;
}
.circle-outer {
fill: none;
stroke: #3c3c3c;
stroke-width: 1;
}
.circle {
fill: none;
stroke: #17E68F;
stroke-width: 3;
animation: progress 1s ease-out forwards;
}
@keyframes progress {
0% {
stroke-dasharray: 0 100;
}
}
.percentage {
fill: #666;
font-size: 0.5em;
text-anchor: middle;
}
Я не могу найти способ «раскрасить» цветной круг внутри другой, как показано на рисунке выше. Я плохо разбираюсь в SVG. Есть ли простое решение? Некоторое свойство SVG, которое я использую?
Спасибо.