Skip to content

Commit 734e305

Browse files
committed
VueUiDonutEvolution create component
1 parent bfc36ab commit 734e305

File tree

13 files changed

+1246
-197
lines changed

13 files changed

+1246
-197
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Available components:
4141
- [VueUiRings](https://vue-data-ui.graphieros.com/docs#vue-ui-rings)
4242
- [VueUiWheel](https://vue-data-ui.graphieros.com/docs#vue-ui-wheel)
4343
- [VueUiTiremarks](https://vue-data-ui.graphieros.com/docs#vue-ui-tiremarks)
44+
- [VueUiDonutEvolution](https://vue-data-ui.graphieros.com/docs#vue-ui-donut-evolution)
4445

4546

4647
## Mini charts

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-data-ui",
33
"private": false,
4-
"version": "1.9.32",
4+
"version": "1.9.33",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [
@@ -33,7 +33,8 @@
3333
"thermometer",
3434
"rings",
3535
"wheel",
36-
"tiremarks"
36+
"tiremarks",
37+
"donut evolution"
3738
],
3839
"author": "Alec Lloyd Probert",
3940
"repository": {

src/App.vue

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import HistoTest from "./components/vue-ui-sparkhistogram.vue";
4242
import RingsTest from "./components/vue-ui-rings.vue";
4343
import WheelTest from "./components/vue-ui-wheel.vue";
4444
import TireTest from "./components/vue-ui-tiremarks.vue";
45+
import DonutEvolutionTest from "./components/vue-ui-donut-evolution.vue";
4546
4647
const dataset = ref([
4748
{
@@ -3528,6 +3529,26 @@ const tiremarksDataset = ref({
35283529
percentage: 75
35293530
})
35303531
3532+
const donutEvolutionDataset = ref([
3533+
{
3534+
name: "Serie 1",
3535+
values: [0, null, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 0 ]
3536+
},
3537+
{
3538+
name: "Serie 2",
3539+
values: [10, null, 20, 10, 10, 10, 10, 10, 10, 10, 10, 10, 0 ]
3540+
},
3541+
{
3542+
name: "Serie 3",
3543+
values: [5, null, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0 ]
3544+
},
3545+
{
3546+
name: "Serie 3",
3547+
values: [5, null, 5, 5, 5, 5 ]
3548+
}
3549+
])
3550+
3551+
35313552
</script>
35323553

35333554
<template>
@@ -3557,6 +3578,20 @@ const tiremarksDataset = ref({
35573578
</template>
35583579
</Box>
35593580

3581+
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_donut_evolution)" open>
3582+
<template #title>VueUiDonutEvolution</template>
3583+
<template #dev>
3584+
<DonutEvolutionTest
3585+
:dataset="donutEvolutionDataset"
3586+
/>
3587+
</template>
3588+
<template #prod>
3589+
<VueUiDonutEvolution
3590+
:dataset="donutEvolutionDataset"
3591+
/>
3592+
</template>
3593+
</Box>
3594+
35603595
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_tiremarks)">
35613596
<template #title>VueUiTiremarks</template>
35623597
<template #dev>

src/atoms/DataTable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const { backgroundColor:tdbg, color:tdc, outline:tdo } = props.config.td;
2323
</tr>
2424
<tr>
2525
<th :style="{backgroundColor: thbg, color: thc, outline: tho}" v-for="(th, i) in head" :key="`th_${i}`">
26-
<div style="display: flex; align-items:center; justify-content:center; justify-content:flex-end;padding-right: 3px;">
26+
<div style="display: flex; align-items:center; justify-content:center; justify-content:flex-end;padding-right: 3px; gap:3px">
2727
<svg height="12" width="12" v-if="th.color" viewBox="0 0 20 20" style="background: none;">
2828
<circle cx="10" cy="10" r="10" :fill="th.color"/>
2929
</svg>

src/atoms/Legend.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ function handleClick(legend, i) {
4848

4949
<style scoped>
5050
.vue-data-ui-legend {
51+
user-select:none;
5152
height: 100%;
5253
width:100%;
5354
display: flex;
@@ -57,6 +58,7 @@ function handleClick(legend, i) {
5758
column-gap: 18px;
5859
}
5960
.vue-data-ui-legend-item {
61+
user-select: none;
6062
display: flex;
6163
align-items:center;
6264
gap: 6px;

src/components/vue-ui-candlestick.vue

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup>
22
import { ref, computed, onMounted, nextTick } from "vue";
3-
import { shiftHue, opacity, makeXls } from "../lib";
3+
import { canShowValue, closestDecimal, shiftHue, opacity, makeXls } from "../lib";
44
import mainConfig from "../default_configs.json";
55
import pdf from "../pdf";
66
import img from "../img";
@@ -165,23 +165,6 @@ function ratioToMax(value) {
165165
return value / extremes.value.max;
166166
}
167167
168-
function canShowValue(value) {
169-
return ![null, undefined, NaN].includes(value);
170-
}
171-
172-
function closestDecimal(number) {
173-
if (number === 0) return 0;
174-
const orderOfMagnitude = Math.floor(Math.log10(Math.abs(number)));
175-
const powerOf10 = 10 ** orderOfMagnitude;
176-
let roundedValue;
177-
if (number < 0) {
178-
roundedValue = Math.round(number / powerOf10) * powerOf10;
179-
} else {
180-
roundedValue = Math.round(number / powerOf10) * powerOf10;
181-
}
182-
return roundedValue;
183-
}
184-
185168
const yLabels = computed(() => {
186169
const positiveStep = closestDecimal(extremes.value.max / candlestickConfig.value.style.layout.grid.yAxis.dataLabels.steps);
187170
const steps = [];

0 commit comments

Comments
 (0)