Skip to content

Commit 40c8917

Browse files
committed
Improvement - VueUiXy - Improved line coating strategy
1 parent 202eab3 commit 40c8917

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

src/components/vue-ui-xy.vue

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -283,15 +283,8 @@
283283
</g>
284284
</g>
285285

286-
<!-- LINES -->
287-
<g v-for="(serie, i) in lineSet" :key="`serie_line_${i}`" :class="`serie_line_${i}`" :style="`opacity:${selectedScale ? selectedScale === serie.id ? 1 : 0.2 : 1};transition:opacity 0.2s ease-in-out`">
288-
<g :data-cy="`xy-line-area-${i}`" v-if="serie.useArea && serie.plots.length > 1">
289-
<path
290-
v-if="serie.smooth"
291-
:d="`M ${serie.plots[0] ? serie.plots[0].x : Math.min(...serie.plots.filter(p => !!p).map(p => p.x))},${chartConfig.chart.grid.labels.yAxis.stacked ? drawingArea.bottom - serie.yOffset : drawingArea.bottom} ${serie.curve} L ${serie.plots.at(-1) ? serie.plots.at(-1).x : (drawingArea.left + (slot.line * i) + slot.line / 2)},${chartConfig.chart.grid.labels.yAxis.stacked ? drawingArea.bottom - serie.yOffset : drawingArea.bottom} Z`" :fill="chartConfig.line.area.useGradient ? `url(#areaGradient_${i}_${uniqueId})` : `${serie.color}${opacity[chartConfig.line.area.opacity]}`"
292-
/>
293-
<path v-else :d="`M${serie.area}Z`" :fill="chartConfig.line.area.useGradient ? `url(#areaGradient_${i}_${uniqueId})` : `${serie.color}${opacity[chartConfig.line.area.opacity]}`"/>
294-
</g>
286+
<!-- LINE COATINGS -->
287+
<g v-for="(serie, i) in lineSet" :key="`serie_line_${i}`" :class="`serie_line_${i}`" :style="`opacity:${selectedScale ? selectedScale === serie.id ? 1 : 0.2 : 1};transition:opacity 0.2s ease-in-out`">
295288
<path
296289
:data-cy="`xy-line-area-path-${i}`"
297290
v-if="serie.smooth && serie.plots.length > 1"
@@ -301,15 +294,6 @@
301294
:stroke-dasharray="serie.dashed ? chartConfig.line.strokeWidth * 2 : 0"
302295
fill="none"
303296
/>
304-
<path
305-
:data-cy="`xy-line-area-path-${i}`"
306-
v-if="serie.smooth && serie.plots.length > 1"
307-
:d="`M${serie.curve}`"
308-
:stroke="serie.color"
309-
:stroke-width="chartConfig.line.strokeWidth"
310-
:stroke-dasharray="serie.dashed ? chartConfig.line.strokeWidth * 2 : 0"
311-
fill="none"
312-
/>
313297
<g v-else-if="serie.plots.length > 1">
314298
<g v-for="(plot, j) in serie.plots" :key="`line_${i}_${j}`">
315299
<line
@@ -325,6 +309,31 @@
325309
stroke-linejoin="round"
326310
stroke-linecap="round"
327311
/>
312+
</g>
313+
</g>
314+
</g>
315+
316+
<!-- LINES -->
317+
<g v-for="(serie, i) in lineSet" :key="`serie_line_${i}`" :class="`serie_line_${i}`" :style="`opacity:${selectedScale ? selectedScale === serie.id ? 1 : 0.2 : 1};transition:opacity 0.2s ease-in-out`">
318+
<g :data-cy="`xy-line-area-${i}`" v-if="serie.useArea && serie.plots.length > 1">
319+
<path
320+
v-if="serie.smooth"
321+
:d="`M ${serie.plots[0] ? serie.plots[0].x : Math.min(...serie.plots.filter(p => !!p).map(p => p.x))},${chartConfig.chart.grid.labels.yAxis.stacked ? drawingArea.bottom - serie.yOffset : drawingArea.bottom} ${serie.curve} L ${serie.plots.at(-1) ? serie.plots.at(-1).x : (drawingArea.left + (slot.line * i) + slot.line / 2)},${chartConfig.chart.grid.labels.yAxis.stacked ? drawingArea.bottom - serie.yOffset : drawingArea.bottom} Z`" :fill="chartConfig.line.area.useGradient ? `url(#areaGradient_${i}_${uniqueId})` : `${serie.color}${opacity[chartConfig.line.area.opacity]}`"
322+
/>
323+
<path v-else :d="`M${serie.area}Z`" :fill="chartConfig.line.area.useGradient ? `url(#areaGradient_${i}_${uniqueId})` : `${serie.color}${opacity[chartConfig.line.area.opacity]}`"/>
324+
</g>
325+
326+
<path
327+
:data-cy="`xy-line-area-path-${i}`"
328+
v-if="serie.smooth && serie.plots.length > 1"
329+
:d="`M${serie.curve}`"
330+
:stroke="serie.color"
331+
:stroke-width="chartConfig.line.strokeWidth"
332+
:stroke-dasharray="serie.dashed ? chartConfig.line.strokeWidth * 2 : 0"
333+
fill="none"
334+
/>
335+
<g v-else-if="serie.plots.length > 1">
336+
<g v-for="(plot, j) in serie.plots" :key="`line_${i}_${j}`">
328337
<line
329338
:data-cy="`xy-line-segment-${i}-${j}`"
330339
v-if="plot && j < serie.plots.length - 1 && serie.plots[j+1] && canShowValue(plot.value) && canShowValue(serie.plots[j+1].value)"

0 commit comments

Comments
 (0)