Skip to content

Commit b6a3909

Browse files
committed
VueUiXy fixed issues with sparkline data table with uneven dataset series lengths
1 parent 4814d56 commit b6a3909

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
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": "1.9.98",
4+
"version": "1.9.99",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [

src/components/vue-ui-xy.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,23 +852,25 @@ export default {
852852
},
853853
tableSparklineDataset() {
854854
return this.relativeDataset.map(ds => {
855+
const source = ds.absoluteValues.map(s => [undefined, null].includes(s) ? 0 : s);
855856
return {
856857
id: ds.id,
857858
name: ds.name,
858859
color: ds.color,
859-
values: ds.absoluteValues.slice(this.slicer.start, this.slicer.end),
860+
values: this.fillArray(this.maxSeries, source)
860861
}
861862
})
862863
},
863864
tableSparklineConfig() {
864865
return {
866+
867+
responsiveBreakpoint: this.chartConfig.table.responsiveBreakpoint,
868+
roundingValues: this.chartConfig.table.rounding,
865869
showAverage: false,
866870
showMedian: false,
867871
showTotal: false,
868-
responsiveBreakpoint: this.chartConfig.table.responsiveBreakpoint,
869-
roundingValues: this.chartConfig.table.rounding,
870872
fontFamily: this.chartConfig.chart.fontFamily,
871-
colNames: this.chartConfig.chart.grid.labels.xAxisLabels.values,
873+
colNames: this.chartConfig.chart.grid.labels.xAxisLabels.values.slice(0, this.maxSeries),
872874
thead: {
873875
backgroundColor: this.chartConfig.table.th.backgroundColor,
874876
color: this.chartConfig.table.th.color,
@@ -1290,6 +1292,13 @@ export default {
12901292
createStar,
12911293
createPolygonPath,
12921294
/////////////////////////////// CANVAS /////////////////////////////////
1295+
fillArray(len, source) {
1296+
let res = Array(len).fill(0);
1297+
for (let i = 0; i < source.length && i < len; i += 1) {
1298+
res[i] = source[i];
1299+
}
1300+
return res;
1301+
},
12931302
refreshSlicer() {
12941303
this.slicer = {
12951304
start: 0,

0 commit comments

Comments
 (0)