From 2bfacfd7831aa66eec38001f629596703f4e74ec Mon Sep 17 00:00:00 2001 From: Matthew Khouzam Date: Mon, 23 Jan 2023 23:06:48 -0500 Subject: [PATCH] part 3 of speedyTSP. Wish I didn't have to do this part Signed-off-by: Matthew Khouzam --- .../data-providers/tsp-data-provider.ts | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/packages/react-components/src/components/data-providers/tsp-data-provider.ts b/packages/react-components/src/components/data-providers/tsp-data-provider.ts index e836d038a..86753271b 100644 --- a/packages/react-components/src/components/data-providers/tsp-data-provider.ts +++ b/packages/react-components/src/components/data-providers/tsp-data-provider.ts @@ -118,6 +118,7 @@ export class TspDataProvider { const rows: TimelineChart.TimeGraphRowModel[] = []; this.timeGraphRows.forEach((row: TimeGraphRow) => { const rowId: number = row.entryId; + const entry = this.timeGraphEntries.find(tgEntry => tgEntry.id === rowId); if (entry) { rows.push(this.getRowModel(row, chartStart, rowId, entry)); @@ -157,13 +158,13 @@ export class TspDataProvider { } const offset = this.timeGraphEntries[0].start; const arrows = timeGraphArrows.map(arrow => ({ - sourceId: arrow.sourceId, - destinationId: arrow.targetId, - range: { - start: arrow.start - offset, - end: arrow.end - offset - } as TimelineChart.TimeGraphRange - } as TimelineChart.TimeGraphArrow + sourceId: arrow.sourceId, + destinationId: arrow.targetId, + range: { + start: arrow.start - offset, + end: arrow.end - offset + } as TimelineChart.TimeGraphRange + } as TimelineChart.TimeGraphArrow )); return arrows; } @@ -175,7 +176,7 @@ export class TspDataProvider { if (timeGraphRow) { newTimeGraphRows.push(timeGraphRow); } else { - const emptyRow: TimeGraphRow = { states: [{ start: BigInt(0), end: BigInt(0), label: '', tags: 0 }], entryId: id }; + const emptyRow: TimeGraphRow = { startTime: BigInt(0), labels: [], styles: [], states: [{ start: BigInt(0), end: BigInt(0), label: 0, tags: 0 }], entryId: id }; newTimeGraphRows.push(emptyRow); } }); @@ -205,13 +206,17 @@ export class TspDataProvider { let prevPossibleState = entry.start; let nextPossibleState = entry.end; row.states.forEach((state: TimeGraphState, idx: number) => { - const end = state.end - chartStart; + const end = state.end - chartStart + state.start; + let labelText = "" + if (state.label) { + labelText = row.labels[state.label] + } states.push({ id: row.entryId + '-' + idx, - label: state.label, + label: labelText, range: { - start: state.start - chartStart, - end + start: state.start - chartStart + row.startTime, + end: end }, data: { style: state.style