I wrote some JavaScript code to generate Pie Charts for me, but when one Slice is bigger than half, the whole thing breaks. Using clip to make half-circles, it is not possible to display more than half, but I cannot understand, why the big part becomes smaller with white on either site.
I assume it would be easiest to change the code to recognize the biggest slice and jest make it a full circle in the bag of the others, but I really would prefer if there were another way.
.pie_container {
width: 500px;
height: 500px;
position: relative;
}
.inner-slice {
position: absolute;
width: 500px;
height: 500px;
border-radius: 50%;
clip: rect(0px, 250px, 500px, 0px);
}
.outer-slice {
position: absolute;
width: 500px;
height: 500px;
border-radius: 50%;
clip: rect(0px, 500px, 500px, 250px);
}
<div class="pie_container">
<div class="outer-slice" style="transform: rotate(0deg);">
<div class="inner-slice" style="background-color: blue;transform: rotate(40deg);"></div>
</div>
<div class="outer-slice" style="transform: rotate(40deg);">
<div class="inner-slice" style="background-color: green;transform: rotate(40deg);"></div>
</div>
<div class="outer-slice" style="transform: rotate(80deg);">
<div class="inner-slice" style="background-color: yellow;transform: rotate(40deg);"></div>
</div>
<div class="outer-slice" style="transform: rotate(120deg);">
<div class="inner-slice" style="background-color: orange;transform: rotate(40deg);"></div>
</div>
<div class="outer-slice" style="transform: rotate(160deg);">
<div class="inner-slice" style="background-color: red;transform: rotate(200deg);"></div>
</div>
</div>