Skip to content

Commit 777202c

Browse files
committed
Improvement - VueUiRidgeline - Hide side strokes on areas
1 parent b16042d commit 777202c

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@
110110
"vitest": "^3.1.1",
111111
"vue": "^3.5.14"
112112
}
113-
}
113+
}

src/components/vue-ui-ridgeline.vue

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
convertCustomPalette,
88
createCsvContent,
99
createSmoothAreaSegments,
10+
createSmoothPath,
1011
createStraightPath,
1112
createUid,
1213
dataLabel,
@@ -391,12 +392,14 @@ const drawableDataset = computed(() => {
391392
const smoothPath = `${createSmoothAreaSegments(plots, zero, false, false)}`;
392393
const straightPath = `M ${startX},${zero} ${createStraightPath(plots)} ${plots.at(-1).x},${zero}`;
393394
const zeroPath = `M ${startX},${zero} ${plots.at(-1).x},${zero}`;
395+
const smoothPathRidge = `M ${createSmoothPath(plots)}`;
396+
const straightPathRidge = `M ${createStraightPath(plots)}`;
394397
395398
396399
const pathLength = getPathLengthFromCoordinates(
397400
FINAL_CONFIG.value.style.chart.areas.smooth
398-
? smoothPath
399-
: straightPath
401+
? smoothPathRidge
402+
: straightPathRidge
400403
);
401404
402405
return {
@@ -406,7 +409,9 @@ const drawableDataset = computed(() => {
406409
smoothPath,
407410
straightPath,
408411
zeroPath,
409-
pathLength
412+
pathLength,
413+
smoothPathRidge,
414+
straightPathRidge
410415
}
411416
})
412417
.filter(dp => !segregated.value.includes(dp.id))
@@ -731,15 +736,26 @@ defineExpose({
731736

732737
<!-- PATH -->
733738
<path
734-
:fill="!FINAL_CONFIG.style.chart.areas.useGradient ? dp.color : FINAL_CONFIG.style.chart.areas.useCommonColor ? `url(#gradient-${dp.id}-${uid})` : `url(#gradient-single-${uid}-${dp.uid})`"
739+
fill="none"
735740
:stroke="FINAL_CONFIG.style.chart.areas.stroke.useSerieColor ? dp.color : FINAL_CONFIG.style.chart.areas.stroke.color"
736741
:stroke-width="FINAL_CONFIG.style.chart.areas.strokeWidth"
742+
:d="FINAL_CONFIG.style.chart.areas.smooth ? dp.smoothPathRidge : dp.straightPathRidge"
743+
stroke-linecap="round" stroke-linejoin="round"
744+
:class="{ 'vue-ui-ridgeline-animate': FINAL_CONFIG.useCssAnimation }"
745+
:style="{
746+
strokeDasharray: dp.pathLength,
747+
strokeDashoffset: FINAL_CONFIG.useCssAnimation ? dp.pathLength : 0,
748+
}"
749+
/>
750+
<path
751+
:fill="!FINAL_CONFIG.style.chart.areas.useGradient ? dp.color : FINAL_CONFIG.style.chart.areas.useCommonColor ? `url(#gradient-${dp.id}-${uid})` : `url(#gradient-single-${uid}-${dp.uid})`"
752+
stroke="none"
737753
:d="FINAL_CONFIG.style.chart.areas.smooth ? dp.smoothPath : dp.straightPath"
738754
stroke-linecap="round" stroke-linejoin="round"
739-
:class="{ 'vue-ui-ridgeline-animate': FINAL_CONFIG.useCssAnimation }" :style="{
755+
:class="{ 'vue-ui-ridgeline-animate': FINAL_CONFIG.useCssAnimation }"
756+
:style="{
740757
strokeDasharray: dp.pathLength,
741758
strokeDashoffset: FINAL_CONFIG.useCssAnimation ? dp.pathLength : 0,
742-
743759
}" />
744760

745761
<!-- ZERO LINE -->

0 commit comments

Comments
 (0)