Skip to content

Commit 9842ee0

Browse files
committed
VueUiScatter minor axis fix
1 parent 6618c43 commit 9842ee0

File tree

3 files changed

+80
-24
lines changed

3 files changed

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

src/App.vue

Lines changed: 78 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -965,28 +965,84 @@ const weeks = computed(() => {
965965
return arr;
966966
});
967967
968-
const scat1 = computed(() => {
969-
const arr = [];
970-
for (let i = -50; i < 50; i += 1) {
971-
arr.push({
972-
x: Math.random() * i + 12,
973-
y: (Math.random() * i) / 20,
974-
name: `plot_${i}_cluster_1`,
975-
});
968+
// const scat1 = computed(() => {
969+
// const arr = [];
970+
// for (let i = 0; i < 50; i += 1) {
971+
// arr.push({
972+
// x: Math.random() * i + 12,
973+
// y: (Math.random() * i) / 20,
974+
// name: `plot_${i}_cluster_1`,
975+
// });
976+
// }
977+
// return arr;
978+
// });
979+
// const scat2 = computed(() => {
980+
// const arr = [];
981+
// for (let i = 0; i < 50; i += 1) {
982+
// arr.push({
983+
// x: (Math.random() * i) / 10,
984+
// y: (Math.random() * i) / 10,
985+
// name: `plot_${i}_cluster_2`,
986+
// });
987+
// }
988+
// return arr;
989+
// });
990+
991+
const scat1 = ref([
992+
{
993+
x: 1,
994+
y: 2,
995+
name: '1'
996+
},
997+
{
998+
x: 0.3,
999+
y: 1.6,
1000+
name: '1'
1001+
},
1002+
{
1003+
x: 3,
1004+
y: 2.1,
1005+
name: '1'
1006+
},
1007+
{
1008+
x: 3,
1009+
y: 2.2,
1010+
name: '1'
1011+
},
1012+
{
1013+
x: 1.3,
1014+
y: 1.2,
1015+
name: '1'
9761016
}
977-
return arr;
978-
});
979-
const scat2 = computed(() => {
980-
const arr = [];
981-
for (let i = -50; i < 50; i += 1) {
982-
arr.push({
983-
x: (Math.random() * i) / 10,
984-
y: (Math.random() * i) / 10,
985-
name: `plot_${i}_cluster_2`,
986-
});
1017+
])
1018+
1019+
const scat2 = ref([
1020+
{
1021+
x: 1,
1022+
y: 2,
1023+
name: '1'
1024+
},
1025+
{
1026+
x: 0.3,
1027+
y: 1.6,
1028+
name: '1'
1029+
},
1030+
{
1031+
x: 3,
1032+
y: 2.1,
1033+
name: '1'
1034+
},
1035+
{
1036+
x: 3,
1037+
y: 20.2,
1038+
name: '1'
1039+
},
1040+
{
1041+
x: 1.3,
1042+
y: -20.2,
1043+
name: '1'
9871044
}
988-
return arr;
989-
});
1045+
])
9901046
9911047
const scatterDataset = computed(() => {
9921048
return [
@@ -3046,7 +3102,7 @@ function selectHistoDatapoint({ datapoint, index }) {
30463102
</template>
30473103
</Box>
30483104

3049-
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_xy)">
3105+
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_xy)">
30503106
<template #title>
30513107
<BaseIcon name="chartLine" />
30523108
VueUiXy
@@ -3159,7 +3215,7 @@ function selectHistoDatapoint({ datapoint, index }) {
31593215
</template>
31603216
</Box>
31613217

3162-
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_scatter)">
3218+
<Box open @copy="copyConfig(PROD_CONFIG.vue_ui_scatter)">
31633219
<template #title>
31643220
<BaseIcon name="chartScatter" />
31653221
VueUiScatter

src/components/vue-ui-scatter.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const extremes = computed(() => {
8686
const xMax = Math.max(...datasetWithId.value.filter(el => !segregated.value.includes(el.id)).flatMap(ds => ds.values.map(v => v.x)));
8787
const yMin = Math.min(...datasetWithId.value.filter(el => !segregated.value.includes(el.id)).flatMap(ds => ds.values.map(v => v.y)));
8888
const yMax = Math.max(...datasetWithId.value.filter(el => !segregated.value.includes(el.id)).flatMap(ds => ds.values.map(v => v.y)));
89-
return { xMin, xMax, yMin, yMax };
89+
return { xMin: xMin >= 0 ? 0 : xMin, xMax, yMin: yMin >= 0 ? 0 : yMin, yMax };
9090
});
9191
9292
const zero = computed(() => {

0 commit comments

Comments
 (0)