diff --git a/app/static/src/app/components/mixins/selectVariables.ts b/app/static/src/app/components/mixins/selectVariables.ts index ade2ef79..908ca341 100644 --- a/app/static/src/app/components/mixins/selectVariables.ts +++ b/app/static/src/app/components/mixins/selectVariables.ts @@ -53,14 +53,15 @@ export default ( const variable = dataTransfer!.getData("variable"); const srcGraphConfig = dataTransfer!.getData("srcGraphConfig"); if (srcGraphConfig !== thisSrcGraphConfig) { - if (srcGraphConfig !== "hidden") { - removeVariable(parseInt(srcGraphConfig, 10), variable); - } - // add to this graph if necessary + // add to this graph if necessary - do this before remove so it is not unlinked if linked variables if (!hasHiddenVariables && !selectedVariables.value.includes(variable)) { const newVars = [...selectedVariables.value, variable]; updateSelectedVariables(graphIndex!, newVars); } + + if (srcGraphConfig !== "hidden") { + removeVariable(parseInt(srcGraphConfig, 10), variable); + } } }; diff --git a/app/static/src/app/components/run/RunPlot.vue b/app/static/src/app/components/run/RunPlot.vue index 658731ce..e334a27a 100644 --- a/app/static/src/app/components/run/RunPlot.vue +++ b/app/static/src/app/components/run/RunPlot.vue @@ -85,7 +85,7 @@ const allPlotData = (start: number, end: number, points: number): WodinPlotData const plotOptions = { showLegend: true, includeLegendGroup: true }; const allData = [ ...odinToPlotly(filterSeriesSet(result, selectedVariables.value), palette.value, plotOptions), - ...allFitDataToPlotly(allFitData.value, palette.value, start, end) + ...allFitDataToPlotly(allFitData.value, palette.value, start, end, props.graphConfig.selectedVariables) ]; // 2. Parameter sets diff --git a/app/static/src/app/components/sensitivity/SensitivityTracesPlot.vue b/app/static/src/app/components/sensitivity/SensitivityTracesPlot.vue index 63976e5f..53ee6e4e 100644 --- a/app/static/src/app/components/sensitivity/SensitivityTracesPlot.vue +++ b/app/static/src/app/components/sensitivity/SensitivityTracesPlot.vue @@ -200,7 +200,8 @@ export default defineComponent({ }); if (allFitData.value) { - result.push(...allFitDataToPlotly(allFitData.value, palette.value, start, end)); + result.push( + ...allFitDataToPlotly(allFitData.value, palette.value, start, end, props.graphConfig.selectedVariables)); } } diff --git a/app/static/src/app/plot.ts b/app/static/src/app/plot.ts index bdee7674..8c3e3450 100644 --- a/app/static/src/app/plot.ts +++ b/app/static/src/app/plot.ts @@ -141,15 +141,21 @@ export function allFitDataToPlotly( allFitData: AllFitData | null, paletteModel: Palette, start: number, - end: number + end: number, + selectedVariables: string[] ): WodinPlotData { if (!allFitData) { return []; } const { data, linkedVariables, timeVariable } = allFitData; + console.log("linked variables") + console.log(JSON.stringify(linkedVariables)) const filteredData = filterData(data, timeVariable, start, end); const palette = paletteData(Object.keys(linkedVariables)); - return Object.keys(linkedVariables).map((name: string) => ({ + // Display column data if it is not linked OR if its linked variable is selected + const columns = Object.keys(linkedVariables) + .filter((column) => !linkedVariables[column] || selectedVariables.includes(linkedVariables[column]!)); + return columns.map((name: string) => ({ name, x: filteredData.map((row: Dict) => row[timeVariable]), y: filteredData.map((row: Dict) => row[name]),