Skip to content

Commit 2f8f4c4

Browse files
committed
Improved error handling
1 parent c57567e commit 2f8f4c4

38 files changed

+1271
-160
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.41",
4+
"version": "2.0.42",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [

src/App.vue

Lines changed: 43 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,33 @@ const donutDataset = [
364364
},
365365
];
366366
367+
const waffleDataset = [
368+
{
369+
name: "serie 1",
370+
color: "",
371+
values: [1],
372+
shape: "star"
373+
},
374+
{
375+
name: "serie 2",
376+
color: "",
377+
values: [2],
378+
shape: "diamond"
379+
},
380+
{
381+
name: "serie 3",
382+
color: "",
383+
values: [3],
384+
shape: "triangle"
385+
},
386+
{
387+
name: "serie 4",
388+
color: "",
389+
values: [3, 5],
390+
shape: "hexagon"
391+
},
392+
];
393+
367394
368395
const radarDataset = ref({
369396
categories: [
@@ -2900,9 +2927,7 @@ function testEmit2(data) {
29002927
</template>
29012928
<template #dev>
29022929
<VueDataUiTest component="VueUiNestedDonuts" :dataset="nestedDonutsDataset" :config="nestedDonutsConfig">
2903-
<template #legend="{ legend }">
2904-
{{ legend }}
2905-
</template>
2930+
29062931
</VueDataUiTest>
29072932
</template>
29082933
<template #prod>
@@ -2990,9 +3015,7 @@ function testEmit2(data) {
29903015
<template #svg="{ svg }">
29913016
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
29923017
</template>
2993-
<template #legend="{ legend }">
2994-
{{ legend }}
2995-
</template>
3018+
29963019
</VueDataUiTest>
29973020
</template>
29983021
<template #prod>
@@ -3092,9 +3115,7 @@ function testEmit2(data) {
30923115
<template #svg="{ svg }">
30933116
<circle :cx="svg.absoluteWidth / 2" :cy="svg.absoluteHeight / 2" :r="30" fill="#FF000033"/>
30943117
</template>
3095-
<template #legend="{ legend }">
3096-
{{ legend }}
3097-
</template>
3118+
30983119
</VueDataUiTest>
30993120
</template>
31003121
<template #prod>
@@ -3235,9 +3256,7 @@ function testEmit2(data) {
32353256
<template #svg="{ svg }">
32363257
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
32373258
</template>
3238-
<template #legend="{ legend }">
3239-
{{ legend }}
3240-
</template>
3259+
32413260
</VueDataUiTest>
32423261
</template>
32433262
<template #prod>
@@ -3374,11 +3393,6 @@ function testEmit2(data) {
33743393
@selectLegend="selectLegendXY"
33753394
@selectX="selectX"
33763395
>
3377-
<template #legend="{ legend }">
3378-
<div v-for="item in legend">
3379-
{{ item.name }} {{ item.color }}
3380-
</div>
3381-
</template>
33823396
</VueDataUiTest>
33833397
<VueDataUiTest
33843398
component="VueUiXy"
@@ -3399,9 +3413,7 @@ function testEmit2(data) {
33993413
<template #svg="{ svg }">
34003414
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
34013415
</template>
3402-
<template #legend="{ legend }">
3403-
{{ legend }}
3404-
</template>
3416+
34053417
</VueDataUi>
34063418
<VueDataUi
34073419
component="VueUiXy"
@@ -3462,9 +3474,7 @@ function testEmit2(data) {
34623474
<template #svg="{ svg }">
34633475
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
34643476
</template>
3465-
<template #legend="{ legend }">
3466-
{{ legend }}
3467-
</template>
3477+
34683478
</VueDataUiTest>
34693479
</template>
34703480
<template #prod>
@@ -3506,9 +3516,7 @@ function testEmit2(data) {
35063516
<template #svg="{ svg }">
35073517
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
35083518
</template>
3509-
<template #legend="{ legend }">
3510-
{{ legend }}
3511-
</template>
3519+
35123520
</VueDataUiTest>
35133521
</template>
35143522
<template #prod>
@@ -3551,9 +3559,7 @@ function testEmit2(data) {
35513559
<template #svg="{ svg }">
35523560
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
35533561
</template>
3554-
<template #legend="{ legend }">
3555-
{{ legend }}
3556-
</template>
3562+
35573563
</VueDataUiTest>
35583564
</template>
35593565
<template #prod>
@@ -3596,9 +3602,7 @@ function testEmit2(data) {
35963602
<template #svg="{ svg }">
35973603
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
35983604
</template>
3599-
<template #legend="{ legend }">
3600-
{{ legend }}
3601-
</template>
3605+
36023606
</VueDataUiTest>
36033607
</template>
36043608
<template #prod>
@@ -3645,9 +3649,7 @@ function testEmit2(data) {
36453649
<template #svg="{ svg }">
36463650
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
36473651
</template>
3648-
<template #legend="{ legend }">
3649-
{{ legend }}
3650-
</template>
3652+
36513653
</VueDataUiTest>
36523654
</template>
36533655
<template #prod>
@@ -3693,9 +3695,7 @@ function testEmit2(data) {
36933695
<template #svg="{ svg }">
36943696
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
36953697
</template>
3696-
<template #legend="{ legend }">
3697-
{{ legend }}
3698-
</template>
3698+
36993699
</VueDataUiTest>
37003700
</template>
37013701
<template #prod>
@@ -3915,9 +3915,7 @@ function testEmit2(data) {
39153915
<template #svg="{ svg }">
39163916
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
39173917
</template>
3918-
<template #legend="{ legend }">
3919-
{{ legend }}
3920-
</template>
3918+
39213919
</VueDataUiTest>
39223920
</template>
39233921
<template #prod>
@@ -3961,9 +3959,7 @@ function testEmit2(data) {
39613959
<template #svg="{ svg }">
39623960
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
39633961
</template>
3964-
<template #legend="{ legend }">
3965-
{{ legend }}
3966-
</template>
3962+
39673963
</VueDataUiTest>
39683964
</template>
39693965
<template #prod>
@@ -3999,25 +3995,20 @@ function testEmit2(data) {
39993995
<VueDataUiTest
40003996
component="VueUiWaffle"
40013997
ref="waffletest"
4002-
:dataset="donutDataset"
3998+
:dataset="waffleDataset"
40033999
:config="waffleConfig"
40044000
@selectLegend="selectLegendWaffle"
40054001
>
40064002
<template #svg="{ svg }">
40074003
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
40084004
</template>
4009-
<template #legend="{ legend }">
4010-
<div v-for="item in legend">
4011-
{{ legend }}
4012-
</div>
4013-
</template>
40144005
</VueDataUiTest>
40154006
</template>
40164007
<template #prod>
40174008
<VueDataUi
40184009
component="VueUiWaffle"
40194010
ref="waffletest"
4020-
:dataset="donutDataset"
4011+
:dataset="waffleDataset"
40214012
:config="waffleConfig"
40224013
@selectLegend="selectLegendWaffle"
40234014
>
@@ -4211,9 +4202,7 @@ function testEmit2(data) {
42114202
<template #svg="{ svg }">
42124203
<circle :cx="svg.width / 2" :cy="svg.height / 2" :r="30" fill="#FF000033"/>
42134204
</template>
4214-
<template #legend="{ legend }">
4215-
{{ legend }}
4216-
</template>
4205+
42174206
</VueDataUiTest>
42184207
</template>
42194208
<template #prod>

src/components/vue-ui-3d-bar.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<script setup>
22
import { ref, computed, onMounted } from "vue";
3-
import { convertColorToHex, createUid } from '../lib';
3+
import {
4+
convertColorToHex,
5+
createUid,
6+
error,
7+
objectIsEmpty
8+
} from '../lib';
49
import pdf from "../pdf";
510
import img from "../img";
611
import mainConfig from "../default_configs.json";
@@ -67,6 +72,13 @@ const box = computed(() => {
6772
const activeValue = ref(barConfig.value.style.chart.animation.use ? 0 : props.dataset.percentage);
6873
6974
onMounted(() => {
75+
if(objectIsEmpty(props.dataset)) {
76+
error({
77+
componentName: 'VueUi3dBar',
78+
type: 'dataset'
79+
})
80+
}
81+
7082
let acceleration = 0;
7183
let speed = barConfig.value.style.chart.animation.speed;
7284
let incr = (0.005) * barConfig.value.style.chart.animation.acceleration;

src/components/vue-ui-age-pyramid.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<script setup>
2-
import { ref, computed, nextTick } from "vue";
2+
import { ref, computed, nextTick, onMounted } from "vue";
33
import {
44
createCsvContent,
55
createUid,
66
downloadCsv,
7+
error,
78
functionReturnsString,
8-
isFunction,
9+
isFunction,
10+
objectIsEmpty,
911
opacity,
1012
shiftHue,
1113
} from '../lib';
@@ -33,8 +35,16 @@ const props = defineProps({
3335
},
3436
});
3537
36-
const uid = ref(createUid());
38+
onMounted(() => {
39+
if(objectIsEmpty(props.dataset)) {
40+
error({
41+
componentName: 'VueUiAgePyramid',
42+
type: 'dataset'
43+
})
44+
}
45+
})
3746
47+
const uid = ref(createUid());
3848
const defaultConfig = ref(mainConfig.vue_ui_age_pyramid);
3949
4050
const isImaging = ref(false);

0 commit comments

Comments
 (0)