Skip to content

Commit

Permalink
VueUiGalaxy improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
graphieros committed Mar 30, 2024
1 parent 273f361 commit b085fe3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-data-ui",
"private": false,
"version": "2.0.45",
"version": "2.0.46",
"type": "module",
"description": "A user-empowering data visualization Vue components library",
"keywords": [
Expand Down
9 changes: 7 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2826,12 +2826,17 @@ const galaxyDataset = ref([
]);
const galaxyConfig = ref({
useBlurOnHover: true,
style: {
chart: {
layout: {
arcs: {
strokeWidth: 6,
borderWidth: 2
// strokeWidth: 6,
// borderWidth: 2
hoverEffect: {
show: true,
multiplicator: 1.1
}
}
},
title: {
Expand Down
18 changes: 7 additions & 11 deletions src/components/vue-ui-galaxy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const mutableConfig = ref({
});
const svg = ref({
height: 160, // or 250 if non fibo
height: 180, // or 250 if non fibo
width: 250
})
Expand Down Expand Up @@ -127,10 +127,6 @@ const total = computed(() => {
return immutableSet.value.filter((ds) => !segregated.value.includes(ds.id)).map(ds => ds.value).reduce((a, b) => a + b, 0);
});
const maxVal = computed(() => {
return Math.max(...immutableSet.value.filter(ds => !segregated.value.includes(ds.id)).map(ds => ds.value));
});
const maxPath = ref(190);
const segregatedSet = computed(() => {
Expand Down Expand Up @@ -166,14 +162,12 @@ const galaxySet = computed(() => {
proportion: serie.value / total.value,
path: createSpiralPath({
points: points,
startX: 115,
startY: 90
startX: 115 + galaxyConfig.value.style.chart.layout.arcs.offsetX,
startY: 90 + galaxyConfig.value.style.chart.layout.arcs.offsetY
})
})
}
console.log(res)
return res
.filter((_, i) => !segregated.value.includes(_.id))
.toSorted((a,b) => b.points - a.points)
Expand Down Expand Up @@ -419,16 +413,18 @@ defineExpose({
:d="datapoint.path"
fill="none"
:stroke="galaxyConfig.style.chart.backgroundColor"
:stroke-width="(galaxyConfig.style.chart.layout.arcs.strokeWidth + galaxyConfig.style.chart.layout.arcs.borderWidth) * (selectedSerie === datapoint.id ? 1.3 : 1)"
: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)"
stroke-linecap="round"

/>
<path
v-if="datapoint.value"
:d="datapoint.path"
fill="none"
:stroke="datapoint.color"
:stroke-width="galaxyConfig.style.chart.layout.arcs.strokeWidth * (selectedSerie === datapoint.id ? 1.3 : 1)"
: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)"
stroke-linecap="round"
:class="`${selectedSerie && selectedSerie !== datapoint.id && galaxyConfig.useBlurOnHover ? 'vue-ui-galaxy-blur' : ''}`"
/>
</g>

Expand Down
11 changes: 9 additions & 2 deletions src/default_configs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3306,15 +3306,22 @@
},
"vue_ui_galaxy": {
"useCssAnimation": true,
"useBlurOnHover": true,
"style": {
"fontFamily": "inherit",
"chart": {
"backgroundColor":"#FFFFFF",
"color":"#2D353C",
"layout": {
"arcs": {
"strokeWidth": 6,
"borderWidth": 2
"strokeWidth": 24,
"borderWidth": 12,
"offsetX": 0,
"offsetY": 0,
"hoverEffect": {
"show": true,
"multiplicator": 1.1
}
},
"labels": {
"dataLabels": {
Expand Down
7 changes: 7 additions & 0 deletions types/vue-data-ui.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ declare module 'vue-data-ui' {

export type VueUiGalaxyConfig = {
useCssAnimation?: boolean;
useBlurOnHover?: boolean;
style?: {
fontFamily?: string;
chart?: {
Expand All @@ -33,6 +34,12 @@ declare module 'vue-data-ui' {
arcs?: {
strokeWidth?: number;
borderWidth?: number;
offsetX?: number;
offsetY?: number;
hoverEffect?: {
show?: boolean;
multiplicator?: number;
}
};
labels?: {
dataLabels?: {
Expand Down

0 comments on commit b085fe3

Please sign in to comment.