Skip to content

Commit

Permalink
Merge pull request #14 from Cambio-Project/Fix-no-data-displayed-for-…
Browse files Browse the repository at this point in the history
…time-0

Shift ValidationResponse to match data set
  • Loading branch information
julianbrott authored Feb 29, 2024
2 parents 0098e34 + f49944c commit 6388337
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class GraphPlotterComponent implements OnInit, AfterViewInit {
Plot.lineY(this.dataset?.data, { x: "time", y: property0 }),
Plot.lineY(this.dataset?.data, Plot.mapY((D: any) => D.map(secondaryYAxis), { x: "time", y: property1, stroke: secondaryYAxisColor }))
);
} else {
} else {
marks.push(...properties.map(property => Plot.line(this.dataset?.data, { x: 'time', y: property })));
yAxis = {
label: properties.join(', '),
Expand All @@ -140,11 +140,10 @@ export class GraphPlotterComponent implements OnInit, AfterViewInit {
} else {
height = Math.max(...properties.map(property => this.dataset?.metricMax(property) || 0)) * 1.5;
}

this.validationResponse.intervals.forEach(interval => {
const arr = Array.from({ length: interval.end - interval.start + 1 }).map((val, i) => {
this.validationResponse.intervals.forEach((interval, intervalIndex) => {
const arr = Array.from({ length: interval.end - interval.start + (intervalIndex > 0 ? 1 : 0) + (this.validationResponse?.intervals && intervalIndex === this.validationResponse?.intervals?.length - 1 ? 1 : 0 )}).map((val, i) => {
return {
time: i + interval.start,
time: i + interval.start + (intervalIndex > 0 ? - 1 : 0),
height: height,
}
});
Expand Down
3 changes: 1 addition & 2 deletions src/app/shared/models/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class Dataset {
this.metricDefinitions = dataset[0];
this.data = dataset.splice(1, dataset.length).map((el: any, i: number) => {
const obj: any = {};
obj.time = i + 1;
obj.time = i;
for (let i = 0; i < this.metricDefinitions.length; i++) {
let val = el[i];
if (!Number.isNaN(val)) {
Expand All @@ -18,7 +18,6 @@ export class Dataset {
}
return obj;
});
//this.metricDefinitions = ['time', ...this.metricDefinitions];
} else {
throw new Error('Invalid Dataset');
}
Expand Down

0 comments on commit 6388337

Please sign in to comment.