Skip to content

Commit 1517fe2

Browse files
committed
VueUiScatter added 'weight' value dataset option to create a bubble chart
1 parent dc20327 commit 1517fe2

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-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: 2 additions & 3 deletions
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.82",
4+
"version": "2.0.83",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [
@@ -84,7 +84,6 @@
8484
"sass": "^1.57.1",
8585
"vite": "^4.5.3",
8686
"vitest": "^0.34.1",
87-
"vue": "^3.3.4",
88-
"vue-data-ui": "file:../vue-data-ui"
87+
"vue": "^3.3.4"
8988
}
9089
}

src/App.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,11 +1037,12 @@ const weeks = computed(() => {
10371037
10381038
const scat1 = computed(() => {
10391039
const arr = [];
1040-
for (let i = 0; i < 50; i += 1) {
1040+
for (let i = 0; i < 200; i += 1) {
10411041
arr.push({
10421042
x: Math.random() * i + 12,
10431043
y: (Math.random() * i) / 20,
10441044
name: `plot_${i}_cluster_1`,
1045+
weight: Math.random() * 10
10451046
});
10461047
}
10471048
return arr;
@@ -1121,11 +1122,11 @@ const scatterDataset = computed(() => {
11211122
values: scat1.value,
11221123
shape: "star"
11231124
},
1124-
{
1125-
name: "Cluster 2",
1126-
values: scat2.value,
1127-
shape: "diamond"
1128-
},
1125+
// {
1126+
// name: "Cluster 2",
1127+
// values: scat2.value,
1128+
// shape: "diamond"
1129+
// },
11291130
];
11301131
});
11311132
@@ -4051,7 +4052,7 @@ function selectBar(bar) {
40514052
</template>
40524053
</Box>
40534054

4054-
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_scatter)">
4055+
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_scatter)">
40554056
<template #title>
40564057
<BaseIcon name="chartScatter" />
40574058
VueUiScatter
@@ -4589,7 +4590,7 @@ function selectBar(bar) {
45894590
</template>
45904591
</Box>
45914592

4592-
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_waffle)">
4593+
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_waffle)">
45934594
<template #title>
45944595
<BaseIcon name="chartWaffle"/>
45954596
VueUiWaffle

src/components/vue-ui-scatter.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ const datasetWithId = computed(() => {
174174
id,
175175
color: ds.color ? ds.color : (palette[i] || palette[i % palette.length]),
176176
opacity: segregated.value.includes(id) ? 0.5: 1,
177-
shape: ds.shape ?? 'circle'
177+
shape: ds.shape ?? 'circle',
178178
}
179179
})
180180
})
@@ -204,7 +204,8 @@ const mutableDataset = computed(() => {
204204
},
205205
clusterName: ds.name,
206206
color: ds.color ? ds.color : (palette[i] || palette[i % palette.length]),
207-
id: `plot_${uid.value}_${Math.random()}`
207+
id: `plot_${uid.value}_${Math.random()}`,
208+
weight: v.weight ?? scatterConfig.value.style.layout.plots.radius
208209
}
209210
}),
210211
}
@@ -562,7 +563,7 @@ defineExpose({
562563
:data-cy="`scatter-plot-${i}-${j}`"
563564
:cx="plot.x"
564565
:cy="plot.y"
565-
:r="selectedPlotId && selectedPlotId === plot.id ? scatterConfig.style.layout.plots.radius * 2 : scatterConfig.style.layout.plots.radius"
566+
:r="selectedPlotId && selectedPlotId === plot.id ? plot.weight * 2 : plot.weight"
566567
:fill="`${ds.color}${opacity[scatterConfig.style.layout.plots.opacity * 100]}`"
567568
:stroke="scatterConfig.style.layout.plots.stroke"
568569
:stroke-width="scatterConfig.style.layout.plots.strokeWidth"
@@ -576,7 +577,7 @@ defineExpose({
576577
v-for="(plot, j) in ds.plots"
577578
:data-cy="`scatter-plot-${i}-${j}`"
578579
:plot="{x: plot.x, y: plot.y }"
579-
:radius="selectedPlotId && selectedPlotId === plot.id ? scatterConfig.style.layout.plots.radius * 2 : scatterConfig.style.layout.plots.radius"
580+
:radius="selectedPlotId && selectedPlotId === plot.id ? plot.weight * 2 : plot.weight"
580581
:shape="ds.shape"
581582
:color="`${ds.color}${opacity[scatterConfig.style.layout.plots.opacity * 100]}`"
582583
:stroke="scatterConfig.style.layout.plots.stroke"

0 commit comments

Comments
 (0)