From fc9af179beedb5f0962c40d65a4f062a9a142519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Fiaudrin?= Date: Wed, 18 Mar 2026 14:00:18 +0100 Subject: [PATCH] handle coordinate dependencies in correct order --- frontend/src/renderer/types/plot.ts | 2 +- frontend/src/renderer/utils/matrix.ts | 4 ++-- frontend/src/renderer/utils/plot.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/renderer/types/plot.ts b/frontend/src/renderer/types/plot.ts index 177e3fe4..5c18f4bb 100644 --- a/frontend/src/renderer/types/plot.ts +++ b/frontend/src/renderer/types/plot.ts @@ -32,7 +32,7 @@ export interface BaseCoordinates { export interface Coordinates extends BaseCoordinates { name: string; shape: number[] | 'irregular'; - coordinates: string[]; + coord_dependencies: string[]; data: AxisData; unit?: string; } diff --git a/frontend/src/renderer/utils/matrix.ts b/frontend/src/renderer/utils/matrix.ts index aa8302cc..82710053 100644 --- a/frontend/src/renderer/utils/matrix.ts +++ b/frontend/src/renderer/utils/matrix.ts @@ -34,7 +34,7 @@ export const getArrayValueFromDependance = ( const wantedCoordinate: Coordinates = coordinates.find( (coord) => coord.axeIndex === axeIndexWanted, ); - if (!wantedCoordinate.coordinates.length) { + if (!wantedCoordinate.coord_dependencies.length) { // get first array value when having no dependance return getFirstArrayValueFromShape( wantedCoordinate.data, @@ -43,7 +43,7 @@ export const getArrayValueFromDependance = ( } // get sorted valueIndex list (sorted by shape length) to access to data matrix - const dependances = wantedCoordinate.coordinates; + const dependances = JSON.parse(JSON.stringify(wantedCoordinate.coord_dependencies)).reverse(); const sortedIndexValueDependances: number[] = []; for (const dependance of dependances) { const coordDep = coordinates.find( diff --git a/frontend/src/renderer/utils/plot.ts b/frontend/src/renderer/utils/plot.ts index 59e2b824..98a6dc1b 100644 --- a/frontend/src/renderer/utils/plot.ts +++ b/frontend/src/renderer/utils/plot.ts @@ -738,7 +738,7 @@ export function formatConfigBeforeLoadingURIs( ...coord, name: '', shape: [], - coordinates: [], + coord_dependencies: [], data: [], }; }) @@ -788,7 +788,7 @@ function formatCoordinates( name: coordinate.name, shape: coordinate.shape, downsampled_shape: coordinate.downsampled_shape, - coordinates: coordinate.coordinates, + coord_dependencies: coordinate.coordinates, data: coordinate.value, valueIndex: valueIndex, path: @@ -888,7 +888,7 @@ export async function plotNodeUriLoaded( matchingCoord.path = getDefaultUri(responseCoordinates.path); matchingCoord.unit = responseCoordinates.unit || ''; matchingCoord.shape = responseCoordinates.downsampled_shape; - matchingCoord.coordinates = responseCoordinates.coordinates; + matchingCoord.coord_dependencies = responseCoordinates.coordinates; //* Update the target - yPath - axis data with the index matchingCoord.target = updateIndexFieldName( @@ -1887,7 +1887,7 @@ export async function applyRangeInCoord( } const dependencyIndex = ( - JSON.parse(JSON.stringify(coordDependencie.coordinates)) as string[] + JSON.parse(JSON.stringify(coordDependencie.coord_dependencies)) as string[] ) .reverse() // We reverse dependencies to get dependency index in the order of the matrix .findIndex((dep) => dep === coordinate.name);