我想要创建一个饼形图,它表示整个进度为8/8,而4/8为一半。我已经创造了一个,但它似乎从90度的角度开始。我要从零度开始。我不想使用旋转,因为它里面有一个文本
到目前为止,这就是我所拥有的
.pie-assign {
border-radius: 50%;
}
.pie-assign circle {
fill: yellow;
stroke: red;
stroke-width: 30;
}
.circle-0 { stroke-dasharray: 0 100; }
.circle-1 { stroke-dasharray: 12.5 150; }
.circle-2 { stroke-dasharray: 25 100; }
.circle-3 { stroke-dasharray: 37.5 100; }
.circle-4 { stroke-dasharray: 50 100; }
.circle-5 { stroke-dasharray: 62.5 100; }
.circle-6 { stroke-dasharray: 75 100; }
.circle-7 { stroke-dasharray: 87.5 100; }
.circle-8 { stroke-dasharray: 105 100; }<div style="width:100px; height: 100px;">
<svg class="pie-assign" viewBox="0 0 30 30">
<circle class="circle-1" r="15" cx="15" cy="15" />
<text x="50%" y="50%" text-anchor="middle" fill="gray" dy=".3em">A</text>
</svg>
</div>
任何帮助都将不胜感激。
发布于 2016-08-26 14:19:09
您可以使用旋转而不旋转您的文本内容。
例如,可以将其应用于<circle>元素:
<circle r="15" cx="15" cy="15" transform="rotate(45,15,15)" />第一个值是以度为单位的旋转。第二和第三值是旋转中心的坐标。
https://stackoverflow.com/questions/39168373
复制相似问题