Skip to content

Commit 031cd34

Browse files
committed
VueUiScatter added giftWrap config option to display the max area occupied by a dataset's plots
1 parent 25e5225 commit 031cd34

File tree

6 files changed

+53
-17
lines changed

6 files changed

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

src/App.vue

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,6 @@ const scat1 = computed(() => {
10421042
x: Math.random() * i + 12,
10431043
y: (Math.random() * i) / 20,
10441044
name: `plot_${i}_cluster_1`,
1045-
weight: Math.random() * 10
10461045
});
10471046
}
10481047
return arr;
@@ -1122,11 +1121,11 @@ const scatterDataset = computed(() => {
11221121
values: scat1.value,
11231122
shape: "star"
11241123
},
1125-
// {
1126-
// name: "Cluster 2",
1127-
// values: scat2.value,
1128-
// shape: "diamond"
1129-
// },
1124+
{
1125+
name: "Cluster 2",
1126+
values: scat2.value,
1127+
shape: "diamond"
1128+
},
11301129
];
11311130
});
11321131
@@ -2786,13 +2785,21 @@ const heatmapConfig = ref({
27862785
27872786
const scatterConfig = ref({
27882787
style: {
2789-
tooltip: {
2790-
showShape: false,
2791-
customFormat: ({ seriesIndex, datapoint, series, config }) => {
2792-
console.log({ seriesIndex, datapoint, series, config });
2793-
return "TEST"
2788+
layout: {
2789+
plots: {
2790+
giftWrap: {
2791+
show: true,
2792+
strokeDasharray: 10
2793+
}
27942794
}
27952795
}
2796+
// tooltip: {
2797+
// showShape: false,
2798+
// customFormat: ({ seriesIndex, datapoint, series, config }) => {
2799+
// console.log({ seriesIndex, datapoint, series, config });
2800+
// return "TEST"
2801+
// }
2802+
// }
27962803
}
27972804
})
27982805
@@ -3442,7 +3449,7 @@ function selectBar(bar) {
34423449
</template>
34433450
</Box>
34443451

3445-
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_nested_donuts)">
3452+
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_nested_donuts)">
34463453
<template #title>
34473454
<BaseIcon name="chartNestedDonuts"/>
34483455
VueUiNestedDonuts
@@ -4053,7 +4060,7 @@ function selectBar(bar) {
40534060
</template>
40544061
</Box>
40554062

4056-
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_scatter)">
4063+
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_scatter)">
40574064
<template #title>
40584065
<BaseIcon name="chartScatter" />
40594066
VueUiScatter
@@ -4823,7 +4830,7 @@ function selectBar(bar) {
48234830
</template>
48244831
</Box>
48254832

4826-
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_gauge)">
4833+
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_gauge)">
48274834
<template #title>
48284835
<BaseIcon name="chartGauge"/>
48294836
VueUiGauge

src/components/vue-ui-scatter.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
downloadCsv,
77
error,
88
functionReturnsString,
9+
giftWrap,
910
isFunction,
1011
objectIsEmpty,
1112
opacity,
@@ -555,6 +556,22 @@ defineExpose({
555556
/>
556557
</g>
557558
559+
<!-- GIFT WRAP -->
560+
<g v-if="scatterConfig.style.layout.plots.giftWrap.show">
561+
<g v-for="(ds, i) in drawableDataset">
562+
<polygon
563+
v-if="ds.plots.length > 2"
564+
:points="giftWrap({series: ds.plots})"
565+
:fill="`${ds.color}${opacity[scatterConfig.style.layout.plots.giftWrap.fillOpacity * 100]}`"
566+
:stroke-width="scatterConfig.style.layout.plots.giftWrap.strokeWidth"
567+
:stroke-dasharray="scatterConfig.style.layout.plots.giftWrap.strokeDasharray"
568+
:stroke="ds.color"
569+
stroke-linejoin="round"
570+
stroke-linecap="round"
571+
/>
572+
</g>
573+
</g>
574+
558575
<!-- PLOTS -->
559576
<g v-for="(ds, i) in drawableDataset">
560577
<g v-if="!ds.shape || ds.shape === 'circle'">

src/default_configs.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,6 +1926,12 @@
19261926
"deviation": {
19271927
"translation": "deviation",
19281928
"roundingValue": 1
1929+
},
1930+
"giftWrap": {
1931+
"show": false,
1932+
"strokeWidth": 1,
1933+
"strokeDasharray": 0,
1934+
"fillOpacity": 0.2
19291935
}
19301936
},
19311937
"correlation": {

types/vue-data-ui.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,6 +1990,12 @@ declare module 'vue-data-ui' {
19901990
translation?: string;
19911991
roundingValue?: number;
19921992
};
1993+
giftWrap?: {
1994+
show?: boolean;
1995+
strokeWidth?: number;
1996+
strokeDasharray?: number;
1997+
fillOpacity?: number;
1998+
};
19931999
};
19942000
correlation?: {
19952001
show?: boolean;

0 commit comments

Comments
 (0)