Skip to content

Commit e7ed77d

Browse files
committed
VueUiIcon added icons
1 parent 132e733 commit e7ed77d

File tree

8 files changed

+44498
-10
lines changed

8 files changed

+44498
-10
lines changed

package-lock.json

Lines changed: 0 additions & 1 deletion
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.81",
4+
"version": "2.0.82",
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: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3316,6 +3316,16 @@ function selectBar(bar) {
33163316
<BaseIcon name="zoomPlus" stroke="#42d392" />
33173317
<BaseIcon name="zoomMinus" stroke="#42d392" />
33183318
<BaseIcon name="chartTreemap" stroke="#42d392" />
3319+
<BaseIcon name="kpi" stroke="#42d392" />
3320+
<BaseIcon name="kpiBox" stroke="#42d392" />
3321+
<BaseIcon name="tooltip" stroke="#42d392" />
3322+
<BaseIcon name="vueDataUi" stroke="#42d392" />
3323+
<BaseIcon name="ratio" stroke="#42d392" />
3324+
<BaseIcon name="func" stroke="#42d392" />
3325+
<BaseIcon name="settings" stroke="#42d392" />
3326+
<BaseIcon name="trendUp" stroke="#42d392" />
3327+
<BaseIcon name="trendDown" stroke="#42d392" />
3328+
<BaseIcon name="clipBoard" stroke="#42d392" />
33193329
</div>
33203330
</template>
33213331
</Box>
@@ -3346,7 +3356,7 @@ function selectBar(bar) {
33463356

33473357
<Box @copy="copyConfig(PROD_CONFIG.vue_ui_kpi)">
33483358
<template #title>
3349-
<!-- <BaseIcon name="chartGalaxy"/> -->
3359+
<BaseIcon name="kpi"/>
33503360
VueUiKpi
33513361
</template>
33523362
<template #info>

src/atoms/BaseIcon.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ const props = defineProps({
2424
const icons = computed(() => {
2525
return {
2626
annotator: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M3 17 4 12C5 12 7 13 8 15L3 17M4 12 11 2C12 2 14 3 15 5L8 15M3 19C5 19 5 19 8 19 11 19 11 18 13 18 15 18 15 19 19 19M12 1C13 1 15 2 16 4" />`,
27-
chart3dBar: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" d="M10 1 6 3 6 17 10 19 14 17 14 3 10 1M6 3 10 5 14 3M10 5 10 19" stroke-linecap="round" stroke-linejoin="round" />`,
28-
chartAgePyramid: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M3 19 17 19M2 17 18 17M1 15 19 15M2 13 18 13M4 11 16 11M2 9 18 9M4 7 17 7M7 5 13 5M9 3 11 3M10 1 11 1" />`,
27+
chart3dBar: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" d="M10 1 6 3 6 17 10 19 14 17 14 3 10 1M6 3 10 5 14 3M10 5 10 19" stroke-linecap="round" stroke-linejoin="round"/><path fill="${props.stroke}" stroke="none" style="opacity:0.3" d="M 6 10 L 10 12 L 14 10 L 14 17 L 10 19 L 6 17 L 6 10"/>`,
28+
chartAgePyramid: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M 1 19 L 9 19 M 11 19 L 19 19 M 2 17 L 9 17 M 11 17 L 18 17 M 2 15 L 9 15 M 11 15 L 18 15 M 3 13 L 9 13 M 11 13 L 17 13 M 3 11 L 9 11 M 11 11 L 17 11 M 4 9 L 9 9 M 11 9 L 16 9 M 4 7 L 9 7 M 11 7 L 16 7 M 5 5 L 9 5 M 11 5 L 15 5 M 6 3 L 9 3 M 11 3 L 14 3 M 7 1 L 9 1 M 11 1 L 13 1" />`,
2929
chartBar: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M2 12 2 18C2 19 2 19 3 19L5 19C6 19 6 19 6 18L6 12C6 11 6 11 5 11L3 11C2 11 2 11 2 12M8 7 8 18C8 19 8 19 9 19L11 19C12 19 12 19 12 18L12 7C12 6 12 6 11 6L9 6C8 6 8 6 8 7M14 2 14 18C14 19 14 19 15 19L17 19C18 19 18 19 18 18L18 2C18 1 18 1 17 1L15 1C14 1 14 1 14 2"/>`,
3030
chartCandlestick: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M2 9 2 11C2 12 3 12 3 12L5 12C6 12 6 11 6 11L6 9C6 8 5 8 5 8L3 8C2 8 2 9 2 9M8 8 8 12C8 12 8 13 9 13L11 13C12 13 12 12 12 12L12 8C12 7 11 7 11 7L9 7C8 7 8 8 8 8M14 9 14 14C14 15 15 15 15 15L17 15C18 15 18 14 18 14L18 9C18 9 18 8 17 8L15 8C14 8 14 9 14 9M4 8 4 5M3 5 5 5M10 13 10 16M9 16 11 16M16 8 16 2M15 2 17 2M10 7 10 4M9 4 11 4M4 12 4 18M3 18 5 18M16 15 16 18M15 18 17 18" />`,
3131
chartChestnut: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M4 3A1 1 0 004 9 1 1 0 004 3M4 12A1 1 0 004 17 1 1 0 004 12M9 4 19 4M9 7 17 7M9 10 15 10M9 13 13 13M9 16 11 16" />`,
@@ -104,7 +104,17 @@ const icons = computed(() => {
104104
chartGalaxy: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M 7 11 A 1 1 0 0 0 11 11 M 14 11 A 1 1 0 0 0 7 11 M 3 11 A 1 1 0 0 0 14 11 M 18 11 A 1 1 0 0 0 3 11 M 16.4 16 C 17 15 18 13 18 11" />`,
105105
zoomPlus: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M 9 1 A 1 1 0 0 0 9 17 A 1 1 0 0 0 9 1 M 14.65 14.65 L 18 18 M 9 5 L 9 13 M 5 9 L 13 9"/>`,
106106
zoomMinus: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M 9 1 A 1 1 0 0 0 9 17 A 1 1 0 0 0 9 1 M 14.65 14.65 L 18 18 M 5 9 L 13 9"/>`,
107-
chartTreemap: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 1 1 L 19 1 L 19 19 L 1 19 Z M 10 1 L 10 19 M 1 13 L 10 13 M 10 10 L 19 10 M 15 10 L 15 19" />`
107+
chartTreemap: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 1 1 L 19 1 L 19 19 L 1 19 Z M 10 1 L 10 19 M 1 13 L 10 13 M 10 10 L 19 10 M 15 10 L 15 19" />`,
108+
kpi: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 2 5 L 2 15 M 6 5 L 2 10 L 6 15 M 8 15 L 8 5 L 10 5 M 10 10 A 1 1 0 0 0 10 5 M 10 10 L 8 10 M 18 5 L 14 5 M 14 15 L 18 15 M 16 5 L 16 15 M 1 3 L 1 2 C 1 1 2 1 2 1 L 18 1 C 18 1 19 1 19 2 L 19 3 M 1 17 L 1 18 C 1 19 2 19 2 19 L 18 19 C 19 19 19 18 19 18 L 19 17"/>`,
109+
kpiBox: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 1 3 C 1 2 2 1 3 1 L 17 1 C 18 1 19 2 19 3 L 19 17 C 19 18 18 19 17 19 L 3 19 C 2 19 1 18 1 17 L 1 3 M 4 13 L 9 13 M 16 13 L 11 13 M 4 16 L 16 16 M 4 4 L 4 10 M 7 4 L 4 7 L 7 10 M 9 10 L 9 4 L 11 4 M 11 7 A 1 1 0 0 0 11 4 M 11 7 L 9 7 M 16 10 L 14 10 M 14 4 L 16 4 M 15 4 L 15 10"/>`,
110+
tooltip: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 8 15 L 10 19 L 12 15 L 18 15 C 18 15 19 15 19 14 L 19 2 C 19 1 18 1 18 1 L 2 1 C 2 1 1 1 1 2 L 1 14 C 1 15 2 15 2 15 L 8 15 M 4 6 L 11 6 M 4 10 L 7 10 M 9 10 L 16 10"/>`,
111+
vueDataUi: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 1 2 L 10.5 18 L 14.5 9 L 16 12 L 19 12 L 14.5 2 L 10.5 12 L 4.5 2 Z"/>`,
112+
ratio: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M 2 10 L 18 10 M 8 1 L 12 7 M 12 1 L 8 7 M 8 13 L 10 16 M 12 13 L 8 19"/>`,
113+
func: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" d="M 17 7 L 13 13 M 13 7 L 17 13 M 12 5 C 12 5 11 5 11 6 L 11 14 C 11 15 12 15 12 15 M 18 5 C 19 5 19 6 19 6 L 19 14 C 19 15 18 15 18 15 M 1 19 C 2 19 3 19 4 17 L 6 3 C 6 2 7 1 8 1 L 10 1 M 5 10 L 7 10" />`,
114+
settings: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M 8 7 A 1 1 0 0 0 8 17 A 1 1 0 0 0 8 7 M 8 6 L 8 7 M 2 12 L 3 12 M 13 12 L 14 12 M 8 17 L 8 18 M 3.6 7.6 L 4.4 8.4 M 3.6 16.4 L 4.4 15.5 M 12.4 7.6 L 11.5 8.4 M 11.6 15.5 L 12.4 16.4 M 8 11 A 1 1 0 0 0 8 13 A 1 1 0 0 0 8 11 M 16 2 A 1 1 0 0 0 16 6 A 1 1 0 0 0 16 2 M 13 4 L 14 4 M 16 6 L 16 7 M 18 4 L 19 4 M 16 1 L 16 2"/>`,
115+
trendUp: `<path stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M 6 3 L 6 7 M 4 5 L 8 5 M 11 7 L 16 3 M 12 2 A 1 1 0 0 0 12 4 A 1 1 0 0 0 12 2 M 15 6 A 1 1 0 0 0 15 8 A 1 1 0 0 0 15 6 M 10 18 L 10 10 M 7 13 L 10 10 L 13 13" />`,
116+
trendDown: `<path stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" d="M 4 5 M 4 5 L 8 5 M 11 7 L 16 3 M 12 2 A 1 1 0 0 0 12 4 A 1 1 0 0 0 12 2 M 15 6 A 1 1 0 0 0 15 8 A 1 1 0 0 0 15 6 M 10 18 L 10 10 M 7 15 L 10 18 L 13 15" />`,
117+
clipBoard: `<path fill="none" stroke="${props.stroke}" stroke-width="${props.strokeWidth}" stroke-linecap="round" stroke-linejoin="round" d="M 6 2 C 6 1 7 1 7 1 L 13 1 C 14 1 14 2 14 2 C 14 2 14 3 13 3 L 7 3 C 7 3 6 3 6 2 M 6 2 L 3 2 C 2 2 1 3 1 4 L 1 17 C 1 18 2 19 3 19 L 17 19 C 18 19 19 18 19 17 L 19 4 C 19 3 18 2 17 2 L 14 2 M 5 7 L 9 7 M 5 11 L 9 11 M 11 11 L 15 11 M 5 15 L 15 15 M 11 7 L 15 7"/>`
108118
}
109119
})
110120

src/lib.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,64 @@ export function createSpiralPath({ points, a, b, angleStep, startX, startY }) {
10461046
return path;
10471047
}
10481048

1049+
export function calculateDistance(point1, point2) {
1050+
return Math.sqrt((point1.x - point2.x) ** 2 + (point1.y - point2.y) ** 2);
1051+
}
1052+
1053+
export function areCirclesOverlapping(circle1, circle2, threshold) {
1054+
const distance = Math.sqrt((circle2.x - circle1.x) ** 2 + (circle2.y - circle1.y) ** 2);
1055+
return distance < threshold;
1056+
}
1057+
1058+
export function calculateAverageDistance(points) {
1059+
if (points.length < 2) return 0;
1060+
1061+
let totalDistance = 0;
1062+
let count = 0;
1063+
1064+
for (let i = 0; i < points.length; i += 1) {
1065+
for (let j = i + 1; j < points.length; j += 1) {
1066+
totalDistance += calculateDistance(points[i], points[j]);
1067+
count += 1;
1068+
}
1069+
}
1070+
return totalDistance / count;
1071+
}
1072+
1073+
export function mergePointsByProximity(points, threshold = 0.15) {
1074+
const clusters = [];
1075+
const visited = new Array(points.length).fill(false);
1076+
1077+
points.forEach((point, index) => {
1078+
if (!visited[index]) {
1079+
const cluster = [];
1080+
const stack = [point];
1081+
visited[index] = true;
1082+
1083+
while (stack.length > 0) {
1084+
const currentPoint = stack.pop();
1085+
cluster.push(currentPoint);
1086+
points.forEach((otherPoint, otherIndex) => {
1087+
if (!visited[otherIndex] && areCirclesOverlapping(currentPoint, otherPoint, threshold)) {
1088+
stack.push(otherPoint);
1089+
visited[otherIndex] = true;
1090+
}
1091+
});
1092+
}
1093+
1094+
clusters.push(cluster);
1095+
}
1096+
});
1097+
1098+
const result = clusters.map(cluster => {
1099+
const averageX = cluster.reduce((acc, p) => acc + p.x, 0) / cluster.length;
1100+
const averageY = cluster.reduce((acc, p) => acc + p.y, 0) / cluster.length;
1101+
return { x: averageX, y: averageY };
1102+
});
1103+
1104+
return result
1105+
}
1106+
10491107
const lib = {
10501108
abbreviate,
10511109
adaptColorToBackground,
@@ -1085,6 +1143,7 @@ const lib = {
10851143
makeDonut,
10861144
makePath,
10871145
matrixTimes,
1146+
mergePointsByProximity,
10881147
objectIsEmpty,
10891148
opacity,
10901149
palette,

0 commit comments

Comments
 (0)