Skip to content

Commit b9919f9

Browse files
committed
fix csv-plots: delete[key] does not work on object
1 parent b119079 commit b9919f9

File tree

1 file changed

+6
-6
lines changed
  • viplab-standalone-frontend-vue/src/components/csv-plots

1 file changed

+6
-6
lines changed

viplab-standalone-frontend-vue/src/components/csv-plots/CsvPlot.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default {
5555
},
5656
data() {
5757
return {
58-
csvs: this.csvsProp,
58+
csvs: this.csvsProp, // this is bad! csvs will never get updated!!
5959
fileIndex: 0,
6060
data: [],
6161
layout: {
@@ -137,18 +137,17 @@ export default {
137137
xkey = this.labelProp.key
138138
}
139139
}
140-
141-
console.log(xkey)
142140
143141
// multiply x-axis by factor if given
144142
if (this.labelProp.factor !== undefined) {
145143
for (let j = 0; j < obj[(xkey)].length; j++) {
146144
obj[(xkey)][j] = obj[(xkey)][j] * this.labelProp.factor
147145
}
148146
}
149-
150-
delete keys[xkey]
151-
147+
let xkey_ind = keys.indexOf(xkey)
148+
if (xkey_ind > -1) {
149+
keys.splice(xkey_ind, 1);
150+
}
152151
// create traces to be rendered later; the first column is always x; the others are ys
153152
for (var k = 0; k < keys.length; k++) {
154153
if (this.datasetProp.key) {
@@ -177,6 +176,7 @@ export default {
177176
}
178177
179178
// set x-Axis label and title
179+
// TODO: allow title in metadata? (id in dumux web-app)
180180
let lastIndex = this.csvs[this.fileIndex].lastIndexOf('/');
181181
let title = ((this.areUrlsProp) ? this.csvs[this.fileIndex].substr(lastIndex + 1, this.csvs[this.fileIndex].length) : "Graph");
182182
let xformat = (this.labelProp.format) ? this.labelProp.format : ".1f"

0 commit comments

Comments
 (0)