Skip to content

Commit 8407341

Browse files
committed
Other - VueUiChord - Cleanup
1 parent e908aed commit 8407341

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

src/components/vue-ui-chord.vue

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ watch(() => props.config, (_newCfg) => {
128128
titleStep.value += 1;
129129
tableStep.value += 1;
130130
legendStep.value += 1;
131-
132-
133131
// Reset mutable config
134132
rotation.value = FINAL_CONFIG.value.initialRotation;
135133
mutableConfig.value.showTable = FINAL_CONFIG.value.table.show;
@@ -158,7 +156,6 @@ function prepareChart() {
158156
isDataset.value && checkDataset();
159157
160158
if (FINAL_CONFIG.value.responsive) {
161-
162159
const wrapperEl = chordChart.value.parentNode;
163160
164161
const resizeHandler = throttle(() => {
@@ -168,7 +165,7 @@ function prepareChart() {
168165
legend: FINAL_CONFIG.value.style.chart.legend.show ? chartLegend.value : null,
169166
source: source.value,
170167
noTitle: noTitle.value,
171-
})
168+
});
172169
173170
const otherH = heightTitle + heightLegend + heightSource + heightNoTitle;
174171
@@ -184,12 +181,12 @@ function prepareChart() {
184181
ro.observe(wrapperEl)
185182
resizeObserver.value = ro;
186183
187-
resizeHandler()
184+
resizeHandler();
188185
}
189186
190187
loadingTimeout.value = setTimeout(() => {
191188
loaded.value = true;
192-
},500)
189+
}, 500)
193190
}
194191
195192
function checkDataset(){
@@ -204,7 +201,7 @@ function checkDataset(){
204201
console.warn(`VueUiChord - Invalid matrix: dataset.matrix at index ${i} has ${m.length} elements instead of the required ${props.dataset.matrix.length}\n\ndataset.matrix[${i}] = [${m.toString()}] has a length of ${m.length} but should have the same length as the matrix itself (${props.dataset.matrix.length})`);
205202
isDataset.value = false;
206203
}
207-
})
204+
});
208205
}
209206
210207
const loadingTimeout = ref(null);
@@ -231,11 +228,11 @@ const radii = computed(() => {
231228
inner: svg.value.width * 0.3 * FINAL_CONFIG.value.style.chart.arcs.innerRadiusRatio,
232229
outer: svg.value.width * 0.34 * FINAL_CONFIG.value.style.chart.arcs.outerRadiusRatio,
233230
}
234-
})
231+
});
235232
236233
const paddingAngle = computed(() => {
237-
return FINAL_CONFIG.value.style.chart.arcs.padAngle / 100
238-
})
234+
return FINAL_CONFIG.value.style.chart.arcs.padAngle / 100;
235+
});
239236
240237
const formattedDataset = computed(() => {
241238
if (!isDataset.value) {
@@ -254,7 +251,7 @@ const formattedDataset = computed(() => {
254251
return customPalette.value[i] || palette[i] || palette[i % palette.length]
255252
})
256253
}
257-
})
254+
});
258255
259256
function computeChord(matrix, padAngle) {
260257
const n = matrix.length;
@@ -1064,26 +1061,26 @@ defineExpose({
10641061
<!-- BACKGROUND STROKE -->
10651062
<line
10661063
:x1="lbl.midBaseX" :y1="lbl.midBaseY"
1067-
:x2="Math.cos(lbl.theta - Math.PI/2)*(radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset +12)"
1068-
:y2="Math.sin(lbl.theta - Math.PI/2)*(radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset +12)"
1064+
:x2="Math.cos(lbl.theta - Math.PI/2) * (radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset + 12)"
1065+
:y2="Math.sin(lbl.theta - Math.PI/2) * (radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset + 12)"
10691066
:stroke="FINAL_CONFIG.style.chart.backgroundColor"
10701067
:stroke-width="FINAL_CONFIG.style.chart.ribbons.labels.connector.strokeWidth * 3"
10711068
pointer-events="none"
10721069
/>
10731070
<!-- MAIN STROKE -->
10741071
<line
10751072
:x1="lbl.midBaseX" :y1="lbl.midBaseY"
1076-
:x2="Math.cos(lbl.theta - Math.PI/2)*(radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset +12)"
1077-
:y2="Math.sin(lbl.theta - Math.PI/2)*(radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset +12)"
1073+
:x2="Math.cos(lbl.theta - Math.PI/2) * (radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset + 12)"
1074+
:y2="Math.sin(lbl.theta - Math.PI/2) * (radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset + 12)"
10781075
:stroke="FINAL_CONFIG.style.chart.ribbons.labels.connector.stroke"
10791076
:stroke-width="FINAL_CONFIG.style.chart.ribbons.labels.connector.strokeWidth"
10801077
pointer-events="none"
10811078
/>
10821079
<!-- DOT -->
10831080
<circle
10841081
v-if="FINAL_CONFIG.style.chart.ribbons.labels.marker.show"
1085-
:cx="Math.cos(lbl.theta - Math.PI/2)*(radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset +12)"
1086-
:cy="Math.sin(lbl.theta - Math.PI/2)*(radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset +12)"
1082+
:cx="Math.cos(lbl.theta - Math.PI/2) * (radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset + 12)"
1083+
:cy="Math.sin(lbl.theta - Math.PI/2) * (radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset + 12)"
10871084
:r="FINAL_CONFIG.style.chart.ribbons.labels.marker.radius"
10881085
:stroke="FINAL_CONFIG.style.chart.ribbons.labels.marker.stroke"
10891086
:stroke-width="FINAL_CONFIG.style.chart.ribbons.labels.marker.strokeWidth"
@@ -1094,8 +1091,8 @@ defineExpose({
10941091
<text
10951092
:transform="`
10961093
translate(
1097-
${Math.cos(lbl.theta - Math.PI/2)*(radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset +24)},
1098-
${Math.sin(lbl.theta - Math.PI/2)*(radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset +24)}
1094+
${Math.cos(lbl.theta - Math.PI/2) * (radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset + 24)},
1095+
${Math.sin(lbl.theta - Math.PI/2) * (radii.outer + FINAL_CONFIG.style.chart.ribbons.labels.offset + 24)}
10991096
) rotate(${-rotation})
11001097
`"
11011098
:fill="FINAL_CONFIG.style.chart.ribbons.labels.useSerieColor
@@ -1181,10 +1178,15 @@ defineExpose({
11811178
@clickMarker="({ legend }) => selectLegendItem(legend.id)"
11821179
>
11831180
<template #legend-pattern="{ legend, index }" v-if="$slots.pattern">
1184-
<Shape :shape="legend.shape" :radius="30" stroke="none" :plot="{ x: 30, y: 30 }"
1185-
:fill="`url(#pattern_${uid}_${index})`" />
1181+
<Shape
1182+
:shape="legend.shape"
1183+
:radius="30"
1184+
stroke="none"
1185+
:plot="{ x: 30, y: 30 }"
1186+
:fill="`url(#pattern_${uid}_${index})`"
1187+
/>
11861188
</template>
1187-
<template #item="{ legend, index }">
1189+
<template #item="{ legend }">
11881190
<div
11891191
data-cy="legend-item"
11901192
:style="{

0 commit comments

Comments
 (0)