Skip to content

Commit 92ab007

Browse files
committed
allow selection of several lines (y-columns) in a configured csv plot
1 parent dd49622 commit 92ab007

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export default {
151151
for (let k = 0; k < keys.length; k++) {
152152
if (this.datasetProp.key) {
153153
// multiply y-axis by factor if given
154-
if (keys[k] === this.datasetProp.key) {
154+
if (keys[k] === this.datasetProp.key || this.datasetProp.key.includes(keys[k])) {
155155
if (this.datasetProp.factor !== undefined) {
156156
for (let j = 0; j < obj[(xkey)].length; j++) {
157157
obj[(keys[k])][j] = obj[(keys[k])][j] * this.datasetProp.factor;
@@ -160,7 +160,7 @@ export default {
160160
const trace = {
161161
x: obj[(xkey)],
162162
y: obj[(keys[k])],
163-
name: this.datasetProp.label,
163+
name: (typeof this.datasetProp.key == 'string') ? this.datasetProp.label : keys[k],
164164
};
165165
traces.push(trace);
166166
}

viplab-standalone-frontend-vue/src/pages/teacher/App.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@
668668
</div>
669669
</div>
670670
<!-- plots -->
671-
<label class="mr-2" for="csvConfig.plots">Information about the Y-Axes: </label>
671+
<label class="mr-2" for="csvConfig.plots">Information about the Y-Axis: </label>
672672
<div class="d-flex ml-4 mr-4">
673673
<div class="flex-grow-1">
674674
<label class="mr-2" for="csvConfig.plots">Define multiple Plots generated from one CSV: </label>
@@ -687,7 +687,7 @@
687687
<!-- key -->
688688
<div class="d-flex form-group">
689689
<div class="flex-grow-1">
690-
<label class="mr-2" for="csvPlot.key">Key of Y-Axes in CSV: </label>
690+
<label class="mr-2" for="csvPlot.key">Key(s) of Y-Axis in CSV: </label>
691691
</div>
692692
<!-- Delete CSV-Config -->
693693
<div class="tooltip-icon pl-2" @click="removePlot($event, csvConfig, csvPlot)">
@@ -700,7 +700,7 @@
700700
</div>
701701
<!-- tooltip -->
702702
<div class="tooltip-icon pl-2">
703-
<b-icon-info-circle v-tooltip.top-center="'Key for y-axis given in csv header.'"></b-icon-info-circle>
703+
<b-icon-info-circle v-tooltip.top-center="'Key(s) for y-axis given in csv header.'"></b-icon-info-circle>
704704
</div>
705705
</div>
706706
<!-- label -->

viplab-standalone-frontend-vue/src/pages/teacher/json-schema/computation-template-container.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@
8282
"type": "object",
8383
"properties": {
8484
"key" : {
85-
"type" : "string",
85+
"type" : ["string", "array"],
8686
"minLength": 1,
87-
"description": "key for y-axis given in csv header"
87+
"description": "key(s) for y-axis given in csv header"
8888
},
8989
"label" : {
9090
"type" : "string",

viplab-standalone-frontend-vue/src/pages/viplab/App.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@
341341
class="outPartcontent"
342342
>
343343
<div v-if="artifact.plots">
344-
<div v-for="plot in artifact.plots" :key="plot.key">
344+
<div v-for="plot in artifact.plots" :key="(typeof plot.key == 'string') ? plot.key : plot.key[0]">
345345
<csv-plot
346346
:csvsProp=artifact.urlsOrContents
347347
:areUrlsProp="false"
@@ -420,7 +420,7 @@
420420
</div>
421421
<div v-else-if="artifact.MIMEtype == 'text/csv'">
422422
<div v-if="artifact.plots">
423-
<div v-for="plot in artifact.plots" :key="plot.key">
423+
<div v-for="plot in artifact.plots" :key="(typeof plot.key == 'string') ? plot.key : plot.key[0]">
424424
<csv-plot
425425
:csvsProp=artifact.urlsOrContents
426426
:areUrlsProp="true"

0 commit comments

Comments
 (0)