File tree Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Expand file tree Collapse file tree 1 file changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -332,7 +332,11 @@ export default {
332332 this .domainObject .configuration .axes .xKey === undefined ||
333333 this .domainObject .configuration .axes .yKey === undefined
334334 ) {
335- return ;
335+ const { xKey , yKey } = this .identifyAxesKeys (axisMetadata);
336+ this .openmct .objects .mutate (this .domainObject , ' configuration.axes' , {
337+ xKey,
338+ yKey
339+ });
336340 }
337341
338342 let xValues = [];
@@ -431,6 +435,30 @@ export default {
431435 subscribeToAll () {
432436 const telemetryObjects = Object .values (this .telemetryObjects );
433437 telemetryObjects .forEach (this .subscribeToObject );
438+ },
439+ identifyAxesKeys (metadata ) {
440+ const { xAxisMetadata , yAxisMetadata } = metadata;
441+
442+ let xKey;
443+ let yKey;
444+
445+ // If xAxisMetadata contains array values, use the first one for xKey
446+ const arrayValues = xAxisMetadata .filter ((metaDatum ) => metaDatum .isArrayValue );
447+ const nonArrayValues = xAxisMetadata .filter ((metaDatum ) => ! metaDatum .isArrayValue );
448+
449+ if (arrayValues .length > 0 ) {
450+ xKey = arrayValues[0 ].key ;
451+ yKey = arrayValues .length > 1 ? arrayValues[1 ].key : yAxisMetadata .key ;
452+ } else if (nonArrayValues .length > 0 ) {
453+ xKey = nonArrayValues[0 ].key ;
454+ yKey = ' none' ;
455+ } else {
456+ // Fallback if no valid xKey or yKey is found
457+ xKey = ' none' ;
458+ yKey = ' none' ;
459+ }
460+
461+ return { xKey, yKey };
434462 }
435463 }
436464};
You can’t perform that action at this time.
0 commit comments