LazStats: Minor improvements in XvsMultYUnit

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7760 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-10-10 15:15:05 +00:00
parent 66a85cf396
commit cd11e879cf

View File

@ -96,7 +96,7 @@ begin
exit; exit;
end; end;
xCol := OS3MainFrm.DataGrid.Rows[0].IndexOf(Trim(XEdit.Text)); xCol := GetVariableIndex(OS3MainFrm.DataGrid, Trim(XEdit.Text));
if xCol = -1 then if xCol = -1 then
begin begin
ErrorMsg('X variable not found.'); ErrorMsg('X variable not found.');
@ -104,14 +104,14 @@ begin
end; end;
nY := YBox.Items.Count; 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 for j := 0 to nY - 1 do
selected[j] := OS3MainFrm.DataGrid.Rows[0].IndexOf(YBox.Items[j]); selected[j] := GetVariableIndex(OS3MainFrm.DataGrid, YBox.Items[j]);
selected[nY] := xCol; selected[nY] := xCol; // This goes into the extra element of "selected"
NoSelected := nY + 1;
SetLength(RowLabels, NoVariables); SetLength(RowLabels, NoSelected);
SetLength(ColLabels, NoVariables); SetLength(ColLabels, NoSelected);
for i := 0 to NoSelected-1 do for i := 0 to NoSelected-1 do
begin begin
RowLabels[i] := Trim(OS3MainFrm.DataGrid.Cells[selected[i],0]); RowLabels[i] := Trim(OS3MainFrm.DataGrid.Cells[selected[i],0]);