From cd11e879cff6388e7b21171873cccfcd4d8fc116 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sat, 10 Oct 2020 15:15:05 +0000 Subject: [PATCH] LazStats: Minor improvements in XvsMultYUnit git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7760 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../forms/analysis/descriptive/xvsmultyunit.pas | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.pas b/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.pas index 5dbe11cd1..6eecee104 100644 --- a/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.pas +++ b/applications/lazstats/source/forms/analysis/descriptive/xvsmultyunit.pas @@ -96,7 +96,7 @@ begin exit; end; - xCol := OS3MainFrm.DataGrid.Rows[0].IndexOf(Trim(XEdit.Text)); + xCol := GetVariableIndex(OS3MainFrm.DataGrid, Trim(XEdit.Text)); if xCol = -1 then begin ErrorMsg('X variable not found.'); @@ -104,14 +104,14 @@ begin end; nY := YBox.Items.Count; - SetLength(selected, nY + 1); // one more for the x column, needed by Correlations() + NoSelected := nY + 1; // one more for the x column, needed by Correlations() + SetLength(selected, NoSelected); for j := 0 to nY - 1 do - selected[j] := OS3MainFrm.DataGrid.Rows[0].IndexOf(YBox.Items[j]); - selected[nY] := xCol; - NoSelected := nY + 1; + selected[j] := GetVariableIndex(OS3MainFrm.DataGrid, YBox.Items[j]); + selected[nY] := xCol; // This goes into the extra element of "selected" - SetLength(RowLabels, NoVariables); - SetLength(ColLabels, NoVariables); + SetLength(RowLabels, NoSelected); + SetLength(ColLabels, NoSelected); for i := 0 to NoSelected-1 do begin RowLabels[i] := Trim(OS3MainFrm.DataGrid.Cells[selected[i],0]);