This commit is contained in:
@@ -17,6 +17,10 @@ export default {
|
||||
yaxis: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
remove_duplicates: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -28,10 +32,23 @@ export default {
|
||||
data: [],
|
||||
yAxisID: index,
|
||||
borderColor: y.color,
|
||||
backgroundColor: y.fill
|
||||
backgroundColor: y.fill,
|
||||
spanGaps: true
|
||||
};
|
||||
for (const data of this.data)
|
||||
res.data.push (resolve_data (data, y.field));
|
||||
let last = null;
|
||||
for (let i = 0; i < this.data.length; i++) {
|
||||
const data = this.data[i];
|
||||
const val = resolve_data (data, y.field);
|
||||
if (
|
||||
!this.remove_duplicates
|
||||
|| last !== val
|
||||
|| this.data.length - 1 === i
|
||||
)
|
||||
res.data.push (val);
|
||||
else
|
||||
res.data.push (null);
|
||||
last = val;
|
||||
}
|
||||
return res;
|
||||
});
|
||||
return { datasets, labels };
|
||||
|
||||
Reference in New Issue
Block a user