Skip to content

Commit b085fe3

Browse files
committed
VueUiGalaxy improvements
1 parent 273f361 commit b085fe3

File tree

5 files changed

+31
-16
lines changed

5 files changed

+31
-16
lines changed

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

src/App.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2826,12 +2826,17 @@ const galaxyDataset = ref([
28262826
]);
28272827
28282828
const galaxyConfig = ref({
2829+
useBlurOnHover: true,
28292830
style: {
28302831
chart: {
28312832
layout: {
28322833
arcs: {
2833-
strokeWidth: 6,
2834-
borderWidth: 2
2834+
// strokeWidth: 6,
2835+
// borderWidth: 2
2836+
hoverEffect: {
2837+
show: true,
2838+
multiplicator: 1.1
2839+
}
28352840
}
28362841
},
28372842
title: {

src/components/vue-ui-galaxy.vue

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const mutableConfig = ref({
7575
});
7676
7777
const svg = ref({
78-
height: 160, // or 250 if non fibo
78+
height: 180, // or 250 if non fibo
7979
width: 250
8080
})
8181
@@ -127,10 +127,6 @@ const total = computed(() => {
127127
return immutableSet.value.filter((ds) => !segregated.value.includes(ds.id)).map(ds => ds.value).reduce((a, b) => a + b, 0);
128128
});
129129
130-
const maxVal = computed(() => {
131-
return Math.max(...immutableSet.value.filter(ds => !segregated.value.includes(ds.id)).map(ds => ds.value));
132-
});
133-
134130
const maxPath = ref(190);
135131
136132
const segregatedSet = computed(() => {
@@ -166,14 +162,12 @@ const galaxySet = computed(() => {
166162
proportion: serie.value / total.value,
167163
path: createSpiralPath({
168164
points: points,
169-
startX: 115,
170-
startY: 90
165+
startX: 115 + galaxyConfig.value.style.chart.layout.arcs.offsetX,
166+
startY: 90 + galaxyConfig.value.style.chart.layout.arcs.offsetY
171167
})
172168
})
173169
}
174170
175-
console.log(res)
176-
177171
return res
178172
.filter((_, i) => !segregated.value.includes(_.id))
179173
.toSorted((a,b) => b.points - a.points)
@@ -419,16 +413,18 @@ defineExpose({
419413
:d="datapoint.path"
420414
fill="none"
421415
:stroke="galaxyConfig.style.chart.backgroundColor"
422-
:stroke-width="(galaxyConfig.style.chart.layout.arcs.strokeWidth + galaxyConfig.style.chart.layout.arcs.borderWidth) * (selectedSerie === datapoint.id ? 1.3 : 1)"
416+
:stroke-width="(galaxyConfig.style.chart.layout.arcs.strokeWidth + galaxyConfig.style.chart.layout.arcs.borderWidth) * (selectedSerie === datapoint.id && galaxyConfig.style.chart.layout.arcs.hoverEffect.show ? galaxyConfig.style.chart.layout.arcs.hoverEffect.multiplicator : 1)"
423417
stroke-linecap="round"
418+
424419
/>
425420
<path
426421
v-if="datapoint.value"
427422
:d="datapoint.path"
428423
fill="none"
429424
:stroke="datapoint.color"
430-
:stroke-width="galaxyConfig.style.chart.layout.arcs.strokeWidth * (selectedSerie === datapoint.id ? 1.3 : 1)"
425+
:stroke-width="galaxyConfig.style.chart.layout.arcs.strokeWidth * (selectedSerie === datapoint.id && galaxyConfig.style.chart.layout.arcs.hoverEffect.show ? galaxyConfig.style.chart.layout.arcs.hoverEffect.multiplicator : 1)"
431426
stroke-linecap="round"
427+
:class="`${selectedSerie && selectedSerie !== datapoint.id && galaxyConfig.useBlurOnHover ? 'vue-ui-galaxy-blur' : ''}`"
432428
/>
433429
</g>
434430

src/default_configs.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3306,15 +3306,22 @@
33063306
},
33073307
"vue_ui_galaxy": {
33083308
"useCssAnimation": true,
3309+
"useBlurOnHover": true,
33093310
"style": {
33103311
"fontFamily": "inherit",
33113312
"chart": {
33123313
"backgroundColor":"#FFFFFF",
33133314
"color":"#2D353C",
33143315
"layout": {
33153316
"arcs": {
3316-
"strokeWidth": 6,
3317-
"borderWidth": 2
3317+
"strokeWidth": 24,
3318+
"borderWidth": 12,
3319+
"offsetX": 0,
3320+
"offsetY": 0,
3321+
"hoverEffect": {
3322+
"show": true,
3323+
"multiplicator": 1.1
3324+
}
33183325
},
33193326
"labels": {
33203327
"dataLabels": {

types/vue-data-ui.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ declare module 'vue-data-ui' {
2424

2525
export type VueUiGalaxyConfig = {
2626
useCssAnimation?: boolean;
27+
useBlurOnHover?: boolean;
2728
style?: {
2829
fontFamily?: string;
2930
chart?: {
@@ -33,6 +34,12 @@ declare module 'vue-data-ui' {
3334
arcs?: {
3435
strokeWidth?: number;
3536
borderWidth?: number;
37+
offsetX?: number;
38+
offsetY?: number;
39+
hoverEffect?: {
40+
show?: boolean;
41+
multiplicator?: number;
42+
}
3643
};
3744
labels?: {
3845
dataLabels?: {

0 commit comments

Comments
 (0)