From de893bc97a938c4199a2da1af1029e9cffb47caf Mon Sep 17 00:00:00 2001 From: Daniel Chang Date: Thu, 31 Oct 2024 15:03:34 -0400 Subject: [PATCH] manually sort loss data points --- .../tera-calibrate-node-ciemss.vue | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/client/hmi-client/src/components/workflow/ops/calibrate-ciemss/tera-calibrate-node-ciemss.vue b/packages/client/hmi-client/src/components/workflow/ops/calibrate-ciemss/tera-calibrate-node-ciemss.vue index 3c03dc3de7..dcb36a5896 100644 --- a/packages/client/hmi-client/src/components/workflow/ops/calibrate-ciemss/tera-calibrate-node-ciemss.vue +++ b/packages/client/hmi-client/src/components/workflow/ops/calibrate-ciemss/tera-calibrate-node-ciemss.vue @@ -140,10 +140,12 @@ async function updateLossChartWithSimulation() { if (props.node.active) { const simulationObj = await getSimulation(props.node.state.calibrationId); if (simulationObj?.updates) { - lossValues = simulationObj?.updates.map((d, i) => ({ - iter: i, - loss: d.data.loss - })); + lossValues = simulationObj?.updates + .sort((a, b) => a.data.progress - b.data.progress) + .map((d, i) => ({ + iter: i, + loss: d.data.loss + })); updateLossChartSpec(lossValues); } } @@ -279,10 +281,12 @@ const pollResult = async (runId: string) => { .setPollAction(async () => pollAction(runId)) .setProgressAction((data: Simulation) => { if (data?.updates?.length) { - lossValues = data?.updates.map((d, i) => ({ - iter: i, - loss: d.data.loss - })); + lossValues = data?.updates + .sort((a, b) => a.data.progress - b.data.progress) + .map((d, i) => ({ + iter: i, + loss: d.data.loss + })); updateLossChartSpec(lossValues); } if (runId === props.node.state.inProgressCalibrationId && data.updates.length > 0) {