@@ -37,6 +37,8 @@ static Constant SF_NUMTRACES_WARN_THRESHOLD = 1000
3737static Constant SF_SWEEPFORMULA_AXIS_X = 0
3838static Constant SF_SWEEPFORMULA_AXIS_Y = 1
3939
40+ static StrConstant SF_UDATA_TABLEFORMULAS = "formulas"
41+
4042Menu "GraphPopup"
4143 "Bring browser to front" , / Q, SF_BringBrowserToFront ()
4244End
@@ -903,7 +905,7 @@ static Function SF_FormulaPlotter(string graph, string formula, [variable dmMode
903905 variable winDisplayMode, showLegend, tagCounter, overrideMarker, line, lineGraph, lineGraphFormula
904906 variable xMxN, yMxN, xPoints, yPoints, keepUserSelection, numAnnotations, formulasAreDifferent, postPlotPSX
905907 variable formulaCounter, gdIndex, markerCode, lineCode, lineStyle, traceToFront, isCategoryAxis, xFormulaOffset
906- variable showInTable
908+ variable showInTable, numTableFormulas , formulaAddedOncePerDataset
907909 string win, winTable, wList, winNameTemplate, exWList, wName, annotation, xAxisLabel, yAxisLabel, wvName, info, xAxis
908910 string formulasRemain, moreFormulas, yAndXFormula, xFormula, yFormula, tagText, name, winHook
909911 STRUCT SF_PlotMetaData plotMetaData
@@ -928,11 +930,12 @@ static Function SF_FormulaPlotter(string graph, string formula, [variable dmMode
928930
929931 for ( j = 0; j < numGraphs; j += 1 )
930932
931- traceCnt = 0
932- numAnnotations = 0
933- postPlotPSX = 0
934- showLegend = 1
935- formulaCounter = 0
933+ traceCnt = 0
934+ numAnnotations = 0
935+ postPlotPSX = 0
936+ showLegend = 1
937+ formulaCounter = 0
938+ numTableFormulas = 0
936939 WAVE /Z wvX = $ ""
937940 WAVE /Z colorGroups = $ ""
938941
@@ -948,14 +951,15 @@ static Function SF_FormulaPlotter(string graph, string formula, [variable dmMode
948951 wList = AddListItem ( winTable, wList)
949952 endif
950953
951- Make / FREE=1/ T/ N= ( MINIMUM_WAVE_SIZE) wAnnotations, formulaArgSetup
954+ Make / FREE=1/ T/ N= ( MINIMUM_WAVE_SIZE) wAnnotations, formulaArgSetup, tableFormulas
952955 Make / FREE=1/ WAVE /N= ( MINIMUM_WAVE_SIZE) collPlotFormData
953956
954957 do
955958
956959 WAVE /WAVE plotFormData = SF_CreatePlotFormulaDataWave ()
957- gdIndex = 0
958- annotation = ""
960+ gdIndex = 0
961+ annotation = ""
962+ formulaAddedOncePerDataset = 0
959963
960964 SplitString / E= SF_SWEEPFORMULA_WITH_REGEXP formulasRemain, yAndXFormula, moreFormulas
961965 if ( ! V_flag)
@@ -1038,6 +1042,14 @@ static Function SF_FormulaPlotter(string graph, string formula, [variable dmMode
10381042 else
10391043 AppendToTable / W=$ winTable wvY. d
10401044 endif
1045+
1046+ if ( ! formulaAddedOncePerDataset)
1047+ EnsureLargeEnoughWave ( tableFormulas, indexShouldExist = numTableFormulas)
1048+ tableFormulas[ numTableFormulas] = JWN_GetStringFromWaveNote ( wvY, SF_META_FORMULA)
1049+ numTableFormulas += 1
1050+ formulaAddedOncePerDataset = 1
1051+ endif
1052+
10411053 dataCnt += 1
10421054 continue
10431055 endif
@@ -1184,6 +1196,11 @@ static Function SF_FormulaPlotter(string graph, string formula, [variable dmMode
11841196 formulaCounter += 1
11851197 while ( 1 )
11861198
1199+ if ( numTableFormulas)
1200+ Redimension / N= ( numTableFormulas) tableFormulas
1201+ SetWindow $ winTable, userdata ( $ SF_UDATA_TABLEFORMULAS) = WaveToJSON ( tableFormulas)
1202+ endif
1203+
11871204 if ( showLegend)
11881205 customLegend = JWN_GetStringFromWaveNote ( formulaResults, SF_META_CUSTOM_LEGEND)
11891206
0 commit comments