Skip to content

Commit 3b858c1

Browse files
committed
VueUiDonutEvolution minor fixes
1 parent b50f34e commit 3b858c1

File tree

4 files changed

+36
-15
lines changed

4 files changed

+36
-15
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-data-ui",
33
"private": false,
4-
"version": "2.0.2",
4+
"version": "2.0.3",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [

src/App.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2401,6 +2401,23 @@ const moodRadarConfig = ref({
24012401
}
24022402
})
24032403
2404+
const donutEvolutionConfig = ref({
2405+
style: {
2406+
chart: {
2407+
layout: {
2408+
grid: {
2409+
xAxis: {
2410+
dataLabels: {
2411+
values: ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC', 'JAN'],
2412+
showOnlyFirstAndLast: true
2413+
}
2414+
}
2415+
}
2416+
}
2417+
}
2418+
}
2419+
})
2420+
24042421
</script>
24052422

24062423
<template>
@@ -2656,7 +2673,7 @@ const moodRadarConfig = ref({
26562673
</template>
26572674
</Box>
26582675

2659-
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_donut_evolution)">
2676+
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_donut_evolution)">
26602677
<template #title>
26612678
<BaseIcon name="chartDonutEvolution"/>
26622679
VueUiDonutEvolution
@@ -2671,6 +2688,7 @@ const moodRadarConfig = ref({
26712688
<template #dev>
26722689
<DonutEvolutionTest
26732690
:dataset="donutEvolutionDataset"
2691+
:config="donutEvolutionConfig"
26742692
>
26752693
<template #svg="{ svg }">
26762694
<circle :cx="svg.absoluteWidth / 2" :cy="svg.absoluteHeight / 2" :r="30" fill="#FF000033"/>
@@ -2680,6 +2698,7 @@ const moodRadarConfig = ref({
26802698
<template #prod>
26812699
<VueUiDonutEvolution
26822700
:dataset="donutEvolutionDataset"
2701+
:config="donutEvolutionConfig"
26832702
>
26842703
<template #svg="{ svg }">
26852704
<circle :cx="svg.absoluteWidth / 2" :cy="svg.absoluteHeight / 2" :r="30" fill="#FF000033"/>

src/components/vue-ui-donut-evolution.vue

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -493,17 +493,19 @@ defineExpose({
493493
494494
<!-- X LABELS -->
495495
<g v-if="donutEvolutionConfig.style.chart.layout.grid.xAxis.dataLabels.show" :class="{'donut-opacity': true, 'donut-behind': isFixed}">
496-
<text
497-
v-for="(_, i) in maxLength"
498-
:x="padding.left + (slit * i) + (slit / 2)"
499-
:y="svg.absoluteHeight - padding.bottom + donutEvolutionConfig.style.chart.layout.grid.xAxis.dataLabels.fontSize * 2"
500-
text-anchor="middle"
501-
:font-size="donutEvolutionConfig.style.chart.layout.grid.xAxis.dataLabels.fontSize"
502-
:fill="donutEvolutionConfig.style.chart.layout.grid.xAxis.dataLabels.color"
496+
<g v-for="(_, i) in maxLength">
497+
<text
498+
v-if="(donutEvolutionConfig.style.chart.layout.grid.xAxis.dataLabels.showOnlyFirstAndLast && (i === 0 || i === maxLength - 1)) || !donutEvolutionConfig.style.chart.layout.grid.xAxis.dataLabels.showOnlyFirstAndLast"
499+
:x="padding.left + (slit * i) + (slit / 2)"
500+
:y="svg.absoluteHeight - padding.bottom + donutEvolutionConfig.style.chart.layout.grid.xAxis.dataLabels.fontSize * 2"
501+
text-anchor="middle"
502+
:font-size="donutEvolutionConfig.style.chart.layout.grid.xAxis.dataLabels.fontSize"
503+
:fill="donutEvolutionConfig.style.chart.layout.grid.xAxis.dataLabels.color"
503504
504-
>
505-
{{ donutEvolutionConfig.style.chart.layout.grid.xAxis.dataLabels.values[i] ?? '' }}
506-
</text>
505+
>
506+
{{ donutEvolutionConfig.style.chart.layout.grid.xAxis.dataLabels.values[i] ?? '' }}
507+
</text>
508+
</g>
507509
</g>
508510
509511
<!-- DATAPOINTS -->
@@ -606,7 +608,7 @@ defineExpose({
606608
<!-- DATALABELS -->
607609
<g v-for="(datapoint, i ) in drawableDataset" :class="{'donut-opacity': true, 'donut-behind': (i !== hoveredIndex && hoveredIndex !== null) || isFixed}">
608610
<text
609-
v-if="datapoint.subtotal !== null"
611+
v-if="datapoint.subtotal !== null && donutEvolutionConfig.style.chart.layout.dataLabels.show"
610612
text-anchor="middle"
611613
:x="datapoint.x"
612614
:y="hoveredIndex === datapoint.index && datapoint.subtotal ? datapoint.y + donutEvolutionConfig.style.chart.layout.dataLabels.fontSize / 3 : datapoint.y - datapoint.radius - donutEvolutionConfig.style.chart.layout.dataLabels.fontSize + donutEvolutionConfig.style.chart.layout.dataLabels.offsetY"

0 commit comments

Comments
 (0)