Skip to content

Commit f2fa154

Browse files
committed
Fix - VueUiXy fixed line areas in multiple scale mode
1 parent 344a1f2 commit f2fa154

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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.1.51",
4+
"version": "2.1.52",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue 3 components library for eloquent data storytelling",
77
"keywords": [

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const dataset2 = ref([
110110
series: [ 55, 34, 21, 13, 8, 5, 3, 2, 1, 1, 0, -1, -1, -2, -3, -5, -8, -13, -21, -34, -55],
111111
type: "line",
112112
color: "rgb(66,211,146)",
113-
useArea: false,
113+
useArea: true,
114114
useProgression: true,
115115
dataLabels: false,
116116
shape: "hexagon",

src/components/vue-ui-xy.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@
362362

363363
<!-- X LABELS BAR -->
364364
<g v-if="(chartConfig.bar.labels.show || chartConfig.bar.serieName.show) && mutableConfig.dataLabels.show">
365-
<g v-for="(serie, i) in barSet" :key="`xLabel_bar_${i}`" :class="`xLabel_bar_${i}`">
365+
<g v-for="(serie, i) in barSet" :key="`xLabel_bar_${i}`" :class="`xLabel_bar_${i}`" :style="`opacity:${selectedScale ? selectedScale === serie.id ? 1 : 0.2 : 1};transition:opacity 0.2s ease-in-out`">
366366
<g v-for="(plot, j) in serie.plots" :key="`xLabel_bar_${i}_${j}`">
367367
<text
368368
:data-cy="`xy-bar-label-x-${i}-${j}`"
@@ -392,7 +392,7 @@
392392

393393
<!-- X LABELS PLOT -->
394394
<g v-if="chartConfig.plot.labels.show && mutableConfig.dataLabels.show">
395-
<g v-for="(serie, i) in plotSet" :key="`xLabel_plot_${i}`" :class="`xLabel_plot_${i}`">
395+
<g v-for="(serie, i) in plotSet" :key="`xLabel_plot_${i}`" :class="`xLabel_plot_${i}`" :style="`opacity:${selectedScale ? selectedScale === serie.id ? 1 : 0.2 : 1};transition:opacity 0.2s ease-in-out`">
396396
<g v-for="(plot, j) in serie.plots" :key="`xLabel_plot_${i}_${j}`">
397397
<text
398398
:data-cy="`xy-plot-label-x-${i}-${j}`"
@@ -437,7 +437,7 @@
437437

438438
<!-- X LABELS LINE -->
439439
<g v-if="chartConfig.line.labels.show && mutableConfig.dataLabels.show">
440-
<g v-for="(serie, i) in lineSet" :key="`xLabel_line_${i}`" :class="`xLabel_line_${i}`">
440+
<g v-for="(serie, i) in lineSet" :key="`xLabel_line_${i}`" :class="`xLabel_line_${i}`" :style="`opacity:${selectedScale ? selectedScale === serie.id ? 1 : 0.2 : 1};transition:opacity 0.2s ease-in-out`">
441441
<g v-for="(plot, j) in serie.plots" :key="`xLabel_line_${i}_${j}`">
442442
<text
443443
:data-cy="`xy-line-label-x-${i}-${j}`"
@@ -1192,7 +1192,7 @@ export default {
11921192
...datapoint,
11931193
curve,
11941194
plots,
1195-
area: !datapoint.useArea ? '' : this.createArea(plots)
1195+
area: !datapoint.useArea ? '' : this.chartConfig.chart.grid.labels.yAxis.useIndividualScale ? this.createIndividualArea(plots, this.drawingArea.bottom) : this.createArea(plots)
11961196
}
11971197
})
11981198
},
@@ -1634,6 +1634,15 @@ export default {
16341634
});
16351635
return [ start.x, start.y, ...path, end.x, end.y].toString();
16361636
},
1637+
createIndividualArea(plots, zero) {
1638+
const start = { x: plots[0].x, y: zero };
1639+
const end = { x: plots.at(-1).x, y: zero };
1640+
const path = [];
1641+
plots.forEach(plot => {
1642+
path.push(`${plot.x},${plot.y} `);
1643+
});
1644+
return [ start.x, start.y, ...path, end.x, end.y].toString();
1645+
},
16371646
createStar,
16381647
createPolygonPath,
16391648
/////////////////////////////// CANVAS /////////////////////////////////

0 commit comments

Comments
 (0)