Skip to content

Commit df7eef0

Browse files
committed
Fix - VueUiDonut - Fix bleeding gradient on transparent background
1 parent f05829a commit df7eef0

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/components/vue-ui-donut.vue

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const svg = ref({
185185
const donutThickness = computed(() => {
186186
const baseRatio = FINAL_CONFIG.value.style.chart.layout.donut.strokeWidth / 512;
187187
const resultSize = svg.value.width * baseRatio
188-
return resultSize > minSize.value / 2 ? FINAL_CONFIG.value.style.chart.layout.donut.strokeWidth : resultSize;
188+
return resultSize > minSize.value ? minSize.value : resultSize;
189189
});
190190
191191
const emit = defineEmits(['selectLegend', 'selectDatapoint'])
@@ -678,9 +678,10 @@ defineExpose({
678678
<!-- DEFS -->
679679
<defs>
680680
<radialGradient :id="`gradient_${uid}`" v-if="FINAL_CONFIG.style.chart.useGradient">
681-
<stop offset="0%" :stop-color="setOpacity(FINAL_CONFIG.style.chart.backgroundColor, 0)" />
681+
<stop offset="0%" :stop-color="setOpacity(FINAL_CONFIG.style.chart.backgroundColor, 0)" stop-opacity="0" />
682+
<stop offset="60%" :stop-color="setOpacity(FINAL_CONFIG.style.chart.backgroundColor, 0)" stop-opacity="0" />
682683
<stop offset="77%" :stop-color="setOpacity('#FFFFFF', FINAL_CONFIG.style.chart.gradientIntensity)" />
683-
<stop offset="100%" :stop-color="setOpacity(FINAL_CONFIG.style.chart.backgroundColor, 0)" />
684+
<stop offset="100%" :stop-color="setOpacity(FINAL_CONFIG.style.chart.backgroundColor, 0)" stop-opacity="0" />
684685
</radialGradient>
685686
</defs>
686687

@@ -775,13 +776,6 @@ defineExpose({
775776
/>
776777
</template>
777778

778-
<circle
779-
v-if="FINAL_CONFIG.style.chart.layout.labels.hollow.show"
780-
:cx="svg.width / 2"
781-
:cy="svg.height / 2"
782-
:r="/* This might require adjustments */(minSize - donutThickness) <= 0 ? 10: minSize - donutThickness"
783-
:fill="FINAL_CONFIG.style.chart.backgroundColor"/>
784-
785779
<!-- HOLLOW LABELS -->
786780
<text
787781
v-if="FINAL_CONFIG.style.chart.layout.labels.hollow.total.show"

0 commit comments

Comments
 (0)