From 5b0e3834af3a2c3e9201f599602edcece49a19a8 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Fri, 4 Mar 2016 16:42:06 +0300 Subject: [PATCH 1/6] Implemented GGpairs plot in correlation dialogue --- instat/dlgCorrelation.designer.vb | 18 +- instat/dlgCorrelation.resx | 238 +++++++++++++------------- instat/dlgCorrelation.vb | 30 ++-- instat/sdgCorrPlot.Designer.vb | 63 ++++++- instat/sdgCorrPlot.vb | 55 +++++- instat/static/InstatObject/R/Rsetup.R | 4 +- 6 files changed, 254 insertions(+), 154 deletions(-) diff --git a/instat/dlgCorrelation.designer.vb b/instat/dlgCorrelation.designer.vb index e160ad60638..db56bf88e90 100644 --- a/instat/dlgCorrelation.designer.vb +++ b/instat/dlgCorrelation.designer.vb @@ -36,11 +36,11 @@ Partial Class dlgCorrelation Me.rdoCompleteRowsOnly = New System.Windows.Forms.RadioButton() Me.lblConfInterval = New System.Windows.Forms.Label() Me.txtConfidenceInterval = New System.Windows.Forms.TextBox() + Me.ucrReceiverMultipleColumns = New instat.ucrReceiverMultiple() Me.ucrReceiverSecondColumn = New instat.ucrReceiverSingle() Me.ucrReceiverFirstColumn = New instat.ucrReceiverSingle() Me.ucrSelectorDataFrameVarAddRemove = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.ucrReceiverMultipleColumns = New instat.ucrReceiverMultiple() Me.grpMethod.SuspendLayout() Me.grpMissing.SuspendLayout() Me.SuspendLayout() @@ -197,6 +197,14 @@ Partial Class dlgCorrelation Me.txtConfidenceInterval.Size = New System.Drawing.Size(100, 20) Me.txtConfidenceInterval.TabIndex = 14 ' + 'ucrReceiverMultipleColumns + ' + Me.ucrReceiverMultipleColumns.Location = New System.Drawing.Point(278, 112) + Me.ucrReceiverMultipleColumns.Name = "ucrReceiverMultipleColumns" + Me.ucrReceiverMultipleColumns.Selector = Nothing + Me.ucrReceiverMultipleColumns.Size = New System.Drawing.Size(121, 104) + Me.ucrReceiverMultipleColumns.TabIndex = 15 + ' 'ucrReceiverSecondColumn ' Me.ucrReceiverSecondColumn.Location = New System.Drawing.Point(301, 181) @@ -227,14 +235,6 @@ Partial Class dlgCorrelation Me.ucrBase.Size = New System.Drawing.Size(409, 57) Me.ucrBase.TabIndex = 1 ' - 'ucrReceiverMultipleColumns - ' - Me.ucrReceiverMultipleColumns.Location = New System.Drawing.Point(278, 112) - Me.ucrReceiverMultipleColumns.Name = "ucrReceiverMultipleColumns" - Me.ucrReceiverMultipleColumns.Selector = Nothing - Me.ucrReceiverMultipleColumns.Size = New System.Drawing.Size(121, 104) - Me.ucrReceiverMultipleColumns.TabIndex = 15 - ' 'dlgCorrelation ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/instat/dlgCorrelation.resx b/instat/dlgCorrelation.resx index 1af7de150c9..29dcb1b3a35 100644 --- a/instat/dlgCorrelation.resx +++ b/instat/dlgCorrelation.resx @@ -1,120 +1,120 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/instat/dlgCorrelation.vb b/instat/dlgCorrelation.vb index aaf9d2719b6..7d966284021 100644 --- a/instat/dlgCorrelation.vb +++ b/instat/dlgCorrelation.vb @@ -18,6 +18,7 @@ Imports instat.Translations Public Class dlgCorrelation Public bFirstLoad As Boolean = True Public bIsTwoColumnFunction As Boolean + Public MultipleVariables Private Sub dlgCorrelation_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Set properties needed on load @@ -51,11 +52,10 @@ Public Class dlgCorrelation ucrSelectorDataFrameVarAddRemove.Focus() rdoPearson.Checked = True rdoTwoColumns.Checked = True + sdgCorrPlot.SetDefaults() TestOKEnabledForTwoColumns() End Sub - - Private Sub ucrReceiverFirstColumn_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverFirstColumn.SelectionChanged ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverFirstColumn.GetVariables()) TestOKEnabledForTwoColumns() @@ -63,11 +63,12 @@ Public Class dlgCorrelation Private Sub ucrReceiverSecondColumn_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverSecondColumn.SelectionChanged ucrBase.clsRsyntax.AddParameter("y", clsRFunctionParameter:=ucrReceiverSecondColumn.GetVariables()) - TestOKEnabledforTwoColumns() - + TestOKEnabledForTwoColumns() End Sub - Private Sub ucrReceiverMultipleColumns_SelectionChanged() Handles ucrReceiverMultipleColumns.SelectionChanged + Public Sub ucrReceiverMultipleColumns_SelectionChanged() Handles ucrReceiverMultipleColumns.SelectionChanged + MultipleVariables = ucrSelectorDataFrameVarAddRemove.ucrAvailableDataFrames.strCurrDataFrame.ToString & "[," & ucrReceiverMultipleColumns.GetVariableNames() & "]" + 'ucrBase.clsRsyntax.AddParameter("Y", MultipleVariables) ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverMultipleColumns.GetVariables()) TestOKEnabledForMultipleColumns() End Sub @@ -86,10 +87,8 @@ Public Class dlgCorrelation ElseIf rdoSpearman.Checked Then ucrBase.clsRsyntax.AddParameter("method", Chr(34) & "spearman" & Chr(34)) - Else ucrBase.clsRsyntax.RemoveParameter("method") - 'the else case should never happen but is there just in case End If End Sub @@ -101,15 +100,10 @@ Public Class dlgCorrelation Private Sub SetUseParameter() If rdoCompleteRowsOnly.Checked Then ucrBase.clsRsyntax.AddParameter("use", Chr(34) & "pairwise.complete.obs" & Chr(34)) - - ElseIf rdoPairwise.Checked Then ucrBase.clsRsyntax.AddParameter("use", Chr(34) & "complete.obs" & Chr(34)) - - Else ucrBase.clsRsyntax.RemoveParameter("use") - End If End Sub @@ -138,8 +132,6 @@ Public Class dlgCorrelation ucrBase.clsRsyntax.AddParameter("alternative", Chr(34) & "two.sided" & Chr(34)) ucrBase.clsRsyntax.AddParameter("exact", "NULL") bIsTwoColumnFunction = True - - End Sub Private Sub SetMultipleColumnAsFunction() @@ -165,7 +157,6 @@ Public Class dlgCorrelation bIsTwoColumnFunction = False End Sub - Private Sub ColumnTypeChanged(sender As Object, e As EventArgs) Handles rdoTwoColumns.CheckedChanged, rdoMultipleColumns.CheckedChanged If rdoTwoColumns.Checked Then SetTwoColumnAsFunction() @@ -177,6 +168,7 @@ Public Class dlgCorrelation Private Sub txtConfidenceInterval_Leave(sender As Object, e As EventArgs) Handles txtConfidenceInterval.Leave ucrBase.clsRsyntax.AddParameter("conf.level", txtConfidenceInterval.Text) End Sub + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() End Sub @@ -184,6 +176,7 @@ Public Class dlgCorrelation Private Sub cmdPlots_Click(sender As Object, e As EventArgs) Handles cmdPlot.Click sdgCorrPlot.ShowDialog() End Sub + Private Sub TestOKEnabledForTwoColumns() If ucrReceiverFirstColumn.IsEmpty() = False And ucrReceiverSecondColumn.IsEmpty() = False And (rdoPearson.Checked = True Or rdoKendall.Checked = True Or rdoSpearman.Checked = True) Then ucrBase.OKEnabled(True) @@ -191,13 +184,20 @@ Public Class dlgCorrelation ucrBase.OKEnabled(False) End If End Sub + Private Sub TestOKEnabledForMultipleColumns() If ucrReceiverMultipleColumns.IsEmpty() = False And ucrReceiverMultipleColumns.lstSelectedVariables.Items.Count > 1 And (rdoCompleteRowsOnly.Checked = True Or rdoPairwise.Checked = True) AndAlso (rdoPearson.Checked = True Or rdoKendall.Checked = True Or rdoSpearman.Checked = True) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) End If + End Sub + Private Sub ucrReceiverMultipleColumns_Load(sender As Object, e As EventArgs) Handles ucrReceiverMultipleColumns.Load + + End Sub + Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk + sdgCorrPlot.RegOptions() End Sub End Class \ No newline at end of file diff --git a/instat/sdgCorrPlot.Designer.vb b/instat/sdgCorrPlot.Designer.vb index 02ff6c54c37..e5bc2e715b6 100644 --- a/instat/sdgCorrPlot.Designer.vb +++ b/instat/sdgCorrPlot.Designer.vb @@ -22,30 +22,75 @@ Partial Class sdgCorrPlot 'Do not modify it using the code editor. _ Private Sub InitializeComponent() - Me.ucrBase = New instat.ucrButtons() + Me.UcrButtonsSubdialogue1 = New instat.ucrButtonsSubdialogue() + Me.tbGraphics = New System.Windows.Forms.TabPage() + Me.tbSdgCorrelation = New System.Windows.Forms.TabControl() + Me.chkGGPairs = New System.Windows.Forms.CheckBox() + Me.tbGraphics.SuspendLayout() + Me.tbSdgCorrelation.SuspendLayout() Me.SuspendLayout() ' - 'ucrBase + 'UcrButtonsSubdialogue1 ' - Me.ucrBase.Location = New System.Drawing.Point(12, 196) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(410, 53) - Me.ucrBase.TabIndex = 0 + Me.UcrButtonsSubdialogue1.Location = New System.Drawing.Point(44, 228) + Me.UcrButtonsSubdialogue1.Name = "UcrButtonsSubdialogue1" + Me.UcrButtonsSubdialogue1.Size = New System.Drawing.Size(142, 30) + Me.UcrButtonsSubdialogue1.TabIndex = 0 + ' + 'tbGraphics + ' + Me.tbGraphics.Controls.Add(Me.chkGGPairs) + Me.tbGraphics.Location = New System.Drawing.Point(4, 22) + Me.tbGraphics.Name = "tbGraphics" + Me.tbGraphics.Padding = New System.Windows.Forms.Padding(3) + Me.tbGraphics.Size = New System.Drawing.Size(204, 184) + Me.tbGraphics.TabIndex = 0 + Me.tbGraphics.Tag = "Graphics" + Me.tbGraphics.Text = "Graphics" + Me.tbGraphics.UseVisualStyleBackColor = True + ' + 'tbSdgCorrelation + ' + Me.tbSdgCorrelation.Controls.Add(Me.tbGraphics) + Me.tbSdgCorrelation.Location = New System.Drawing.Point(12, 12) + Me.tbSdgCorrelation.Name = "tbSdgCorrelation" + Me.tbSdgCorrelation.SelectedIndex = 0 + Me.tbSdgCorrelation.Size = New System.Drawing.Size(212, 210) + Me.tbSdgCorrelation.TabIndex = 1 + Me.tbSdgCorrelation.Tag = "" + ' + 'chkGGPairs + ' + Me.chkGGPairs.AutoSize = True + Me.chkGGPairs.Location = New System.Drawing.Point(28, 31) + Me.chkGGPairs.Name = "chkGGPairs" + Me.chkGGPairs.Size = New System.Drawing.Size(68, 17) + Me.chkGGPairs.TabIndex = 0 + Me.chkGGPairs.Tag = "GG_Pairs" + Me.chkGGPairs.Text = "GG Pairs" + Me.chkGGPairs.UseVisualStyleBackColor = True ' 'sdgCorrPlot ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(426, 261) - Me.Controls.Add(Me.ucrBase) + Me.ClientSize = New System.Drawing.Size(227, 261) + Me.Controls.Add(Me.tbSdgCorrelation) + Me.Controls.Add(Me.UcrButtonsSubdialogue1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.Name = "sdgCorrPlot" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Tag = "corrplot" Me.Text = "corrplot" + Me.tbGraphics.ResumeLayout(False) + Me.tbGraphics.PerformLayout() + Me.tbSdgCorrelation.ResumeLayout(False) Me.ResumeLayout(False) End Sub - Friend WithEvents ucrBase As ucrButtons + Friend WithEvents UcrButtonsSubdialogue1 As ucrButtonsSubdialogue + Friend WithEvents tbGraphics As TabPage + Friend WithEvents chkGGPairs As CheckBox + Friend WithEvents tbSdgCorrelation As TabControl End Class diff --git a/instat/sdgCorrPlot.vb b/instat/sdgCorrPlot.vb index ef63d5f8bd2..d43eee9dda5 100644 --- a/instat/sdgCorrPlot.vb +++ b/instat/sdgCorrPlot.vb @@ -1,3 +1,56 @@ -Public Class sdgCorrPlot +' Instat-R +' Copyright (C) 2015 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License k +' along with this program. If not, see . +Imports instat.Translations +Public Class sdgCorrPlot + 'Public clsRGraphics As New RSyntax + Public clsRaovFunction, clsRGGPairsFunction, clsRaovpvalFunction, clsRestpvalFunction, clsRFourPlotsFunction, clsRgeom_point As New RFunction + Public bFirstLoad As Boolean = True + Private Sub sdgCorrPlot_Load(sender As Object, e As EventArgs) Handles MyBase.Load + autoTranslate(Me) + + If bFirstLoad Then + SetDefaults() + bFirstLoad = False + End If + End Sub + + Private Sub GGPairs() + Dim clsRGraphics As New RSyntax + 'clsRGraphics.SetFunction("ggpairs") + 'clsRGraphics.AddParameter("data", clsRFunctionParameter:=dlgCorrelation.ucrSelectorDataFrameVarAddRemove.ucrAvailableDataFrames.clsCurrDataFrame) + 'clsRGraphics.AddParameter("columns", dlgCorrelation.ucrReceiverMultipleColumns.GetVariableNames()) + 'frmMain.clsRLink.RunScript(clsRGraphics.GetScript(), 2) + clsRGraphics.SetOperatorParameter(True, clsRFunc:=clsRGGPairsFunction) + clsRGraphics.SetOperation("") + clsRGGPairsFunction.SetRCommand("ggpairs") + clsRGGPairsFunction.AddParameter("data", clsRFunctionParameter:=dlgCorrelation.ucrSelectorDataFrameVarAddRemove.ucrAvailableDataFrames.clsCurrDataFrame) + clsRGGPairsFunction.AddParameter("columns", dlgCorrelation.ucrReceiverMultipleColumns.GetVariableNames()) + clsRGraphics.SetOperatorParameter(True, clsRFunc:=clsRGGPairsFunction) + 'Calltype is not the right one but it works + frmMain.clsRLink.RunScript(clsRGraphics.GetScript(), 2) + End Sub + + Public Sub SetDefaults() + chkGGPairs.Checked = True + End Sub + + Public Sub RegOptions() + If (chkGGPairs.Checked = True) Then + GGPairs() + End If + End Sub End Class \ No newline at end of file diff --git a/instat/static/InstatObject/R/Rsetup.R b/instat/static/InstatObject/R/Rsetup.R index a498b14977d..7e474ada7c4 100644 --- a/instat/static/InstatObject/R/Rsetup.R +++ b/instat/static/InstatObject/R/Rsetup.R @@ -7,4 +7,6 @@ library(ggplot2) library(extRemes) # TODO do we need reshape? It causes conflicts with reshape2 but this can be avoided if reshape is really needed #library(reshape) -library(ggfortify) \ No newline at end of file +library(ggfortify) +library(GGally) +library(CCA) \ No newline at end of file From 839eef7e411a5f84520650b2824ae9a801f3b822 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Sat, 5 Mar 2016 11:57:32 +0300 Subject: [PATCH 2/6] Fixed ggpairs functon in adgcorrplot --- instat/sdgCorrPlot.vb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/instat/sdgCorrPlot.vb b/instat/sdgCorrPlot.vb index d43eee9dda5..ad75ca0c6e2 100644 --- a/instat/sdgCorrPlot.vb +++ b/instat/sdgCorrPlot.vb @@ -15,8 +15,7 @@ ' along with this program. If not, see . Imports instat.Translations Public Class sdgCorrPlot - 'Public clsRGraphics As New RSyntax - Public clsRaovFunction, clsRGGPairsFunction, clsRaovpvalFunction, clsRestpvalFunction, clsRFourPlotsFunction, clsRgeom_point As New RFunction + Public clsRGGPairsFunction As New RFunction Public bFirstLoad As Boolean = True Private Sub sdgCorrPlot_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -30,22 +29,23 @@ Public Class sdgCorrPlot Private Sub GGPairs() Dim clsRGraphics As New RSyntax - 'clsRGraphics.SetFunction("ggpairs") - 'clsRGraphics.AddParameter("data", clsRFunctionParameter:=dlgCorrelation.ucrSelectorDataFrameVarAddRemove.ucrAvailableDataFrames.clsCurrDataFrame) - 'clsRGraphics.AddParameter("columns", dlgCorrelation.ucrReceiverMultipleColumns.GetVariableNames()) - 'frmMain.clsRLink.RunScript(clsRGraphics.GetScript(), 2) - clsRGraphics.SetOperatorParameter(True, clsRFunc:=clsRGGPairsFunction) - clsRGraphics.SetOperation("") - clsRGGPairsFunction.SetRCommand("ggpairs") - clsRGGPairsFunction.AddParameter("data", clsRFunctionParameter:=dlgCorrelation.ucrSelectorDataFrameVarAddRemove.ucrAvailableDataFrames.clsCurrDataFrame) - clsRGGPairsFunction.AddParameter("columns", dlgCorrelation.ucrReceiverMultipleColumns.GetVariableNames()) - clsRGraphics.SetOperatorParameter(True, clsRFunc:=clsRGGPairsFunction) + clsRGraphics.SetFunction("ggpairs") + clsRGraphics.AddParameter("data", clsRFunctionParameter:=dlgCorrelation.ucrSelectorDataFrameVarAddRemove.ucrAvailableDataFrames.clsCurrDataFrame) + clsRGraphics.AddParameter("columns", dlgCorrelation.ucrReceiverMultipleColumns.GetVariableNames()) + + 'clsRGraphics.SetOperatorParameter(True, clsRFunc:=clsRGGPairsFunction) + 'clsRGraphics.SetOperation("") + 'clsRGGPairsFunction.SetRCommand("ggpairs") + 'clsRGGPairsFunction.AddParameter("data", clsRFunctionParameter:=dlgCorrelation.ucrSelectorDataFrameVarAddRemove.ucrAvailableDataFrames.clsCurrDataFrame) + 'clsRGGPairsFunction.AddParameter("columns", dlgCorrelation.ucrReceiverMultipleColumns.GetVariableNames()) + 'clsRGraphics.SetOperatorParameter(True, clsRFunc:=clsRGGPairsFunction) + 'Calltype is not the right one but it works frmMain.clsRLink.RunScript(clsRGraphics.GetScript(), 2) End Sub Public Sub SetDefaults() - chkGGPairs.Checked = True + chkGGPairs.Checked = False End Sub Public Sub RegOptions() From 1f24be8acc96cb439f0c2187da2b52b7799ad6a6 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Sat, 5 Mar 2016 12:38:43 +0300 Subject: [PATCH 3/6] Implemented ggcorr in correlation dialogue --- instat/sdgCorrPlot.Designer.vb | 34 ++++++++++++++++++++++++---------- instat/sdgCorrPlot.vb | 18 ++++++++++++++++++ 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/instat/sdgCorrPlot.Designer.vb b/instat/sdgCorrPlot.Designer.vb index e5bc2e715b6..2b61ed52e7e 100644 --- a/instat/sdgCorrPlot.Designer.vb +++ b/instat/sdgCorrPlot.Designer.vb @@ -24,8 +24,9 @@ Partial Class sdgCorrPlot Private Sub InitializeComponent() Me.UcrButtonsSubdialogue1 = New instat.ucrButtonsSubdialogue() Me.tbGraphics = New System.Windows.Forms.TabPage() - Me.tbSdgCorrelation = New System.Windows.Forms.TabControl() Me.chkGGPairs = New System.Windows.Forms.CheckBox() + Me.tbSdgCorrelation = New System.Windows.Forms.TabControl() + Me.chkGGcorr = New System.Windows.Forms.CheckBox() Me.tbGraphics.SuspendLayout() Me.tbSdgCorrelation.SuspendLayout() Me.SuspendLayout() @@ -39,6 +40,7 @@ Partial Class sdgCorrPlot ' 'tbGraphics ' + Me.tbGraphics.Controls.Add(Me.chkGGcorr) Me.tbGraphics.Controls.Add(Me.chkGGPairs) Me.tbGraphics.Location = New System.Drawing.Point(4, 22) Me.tbGraphics.Name = "tbGraphics" @@ -49,6 +51,17 @@ Partial Class sdgCorrPlot Me.tbGraphics.Text = "Graphics" Me.tbGraphics.UseVisualStyleBackColor = True ' + 'chkGGPairs + ' + Me.chkGGPairs.AutoSize = True + Me.chkGGPairs.Location = New System.Drawing.Point(28, 31) + Me.chkGGPairs.Name = "chkGGPairs" + Me.chkGGPairs.Size = New System.Drawing.Size(68, 17) + Me.chkGGPairs.TabIndex = 0 + Me.chkGGPairs.Tag = "GG_Pairs" + Me.chkGGPairs.Text = "GG Pairs" + Me.chkGGPairs.UseVisualStyleBackColor = True + ' 'tbSdgCorrelation ' Me.tbSdgCorrelation.Controls.Add(Me.tbGraphics) @@ -59,16 +72,16 @@ Partial Class sdgCorrPlot Me.tbSdgCorrelation.TabIndex = 1 Me.tbSdgCorrelation.Tag = "" ' - 'chkGGPairs + 'chkGGcorr ' - Me.chkGGPairs.AutoSize = True - Me.chkGGPairs.Location = New System.Drawing.Point(28, 31) - Me.chkGGPairs.Name = "chkGGPairs" - Me.chkGGPairs.Size = New System.Drawing.Size(68, 17) - Me.chkGGPairs.TabIndex = 0 - Me.chkGGPairs.Tag = "GG_Pairs" - Me.chkGGPairs.Text = "GG Pairs" - Me.chkGGPairs.UseVisualStyleBackColor = True + Me.chkGGcorr.AutoSize = True + Me.chkGGcorr.Location = New System.Drawing.Point(28, 54) + Me.chkGGcorr.Name = "chkGGcorr" + Me.chkGGcorr.Size = New System.Drawing.Size(63, 17) + Me.chkGGcorr.TabIndex = 1 + Me.chkGGcorr.Tag = "GG_corr" + Me.chkGGcorr.Text = "GG corr" + Me.chkGGcorr.UseVisualStyleBackColor = True ' 'sdgCorrPlot ' @@ -93,4 +106,5 @@ Partial Class sdgCorrPlot Friend WithEvents tbGraphics As TabPage Friend WithEvents chkGGPairs As CheckBox Friend WithEvents tbSdgCorrelation As TabControl + Friend WithEvents chkGGcorr As CheckBox End Class diff --git a/instat/sdgCorrPlot.vb b/instat/sdgCorrPlot.vb index ad75ca0c6e2..89fb9c2d9c3 100644 --- a/instat/sdgCorrPlot.vb +++ b/instat/sdgCorrPlot.vb @@ -44,13 +44,31 @@ Public Class sdgCorrPlot frmMain.clsRLink.RunScript(clsRGraphics.GetScript(), 2) End Sub + Private Sub GGcorr() + Dim clsRGGcorrGraphics As New RSyntax + 'We may have to save the correlation matrix then use it here. + 'We still need to add more arguments to the ggcorr function + clsRGGcorrGraphics.SetFunction("ggcorr") + clsRGGcorrGraphics.AddParameter("data", "NULL") + clsRGGcorrGraphics.AddParameter("cor_matrix", dlgCorrelation.ucrBase.clsRsyntax.GetScript()) + + + 'Calltype is not the right one but it works + frmMain.clsRLink.RunScript(clsRGGcorrGraphics.GetScript(), 2) + End Sub + + Public Sub SetDefaults() chkGGPairs.Checked = False + chkGGcorr.Checked = False End Sub Public Sub RegOptions() If (chkGGPairs.Checked = True) Then GGPairs() End If + If (chkGGcorr.Checked = True) Then + GGcorr() + End If End Sub End Class \ No newline at end of file From cf836ffeebe881cd2195108bea28a829f025eee6 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Sat, 5 Mar 2016 14:38:22 +0300 Subject: [PATCH 4/6] tyding up correlation --- instat/dlgCorrelation.vb | 3 --- 1 file changed, 3 deletions(-) diff --git a/instat/dlgCorrelation.vb b/instat/dlgCorrelation.vb index 7d966284021..3be993590ef 100644 --- a/instat/dlgCorrelation.vb +++ b/instat/dlgCorrelation.vb @@ -18,7 +18,6 @@ Imports instat.Translations Public Class dlgCorrelation Public bFirstLoad As Boolean = True Public bIsTwoColumnFunction As Boolean - Public MultipleVariables Private Sub dlgCorrelation_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Set properties needed on load @@ -67,8 +66,6 @@ Public Class dlgCorrelation End Sub Public Sub ucrReceiverMultipleColumns_SelectionChanged() Handles ucrReceiverMultipleColumns.SelectionChanged - MultipleVariables = ucrSelectorDataFrameVarAddRemove.ucrAvailableDataFrames.strCurrDataFrame.ToString & "[," & ucrReceiverMultipleColumns.GetVariableNames() & "]" - 'ucrBase.clsRsyntax.AddParameter("Y", MultipleVariables) ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverMultipleColumns.GetVariables()) TestOKEnabledForMultipleColumns() End Sub From 7fa29567ee7848059938f24a1df85aed9d91896e Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Mon, 7 Mar 2016 14:42:13 +0300 Subject: [PATCH 5/6] Fixing TestOk and Tab Order for correlation dialogue --- instat/dlgCorrelation.designer.vb | 26 ++++++++++---------- instat/dlgCorrelation.vb | 41 +++++++++++-------------------- 2 files changed, 28 insertions(+), 39 deletions(-) diff --git a/instat/dlgCorrelation.designer.vb b/instat/dlgCorrelation.designer.vb index db56bf88e90..97a7b5871b5 100644 --- a/instat/dlgCorrelation.designer.vb +++ b/instat/dlgCorrelation.designer.vb @@ -51,7 +51,7 @@ Partial Class dlgCorrelation Me.rdoTwoColumns.Location = New System.Drawing.Point(3, 11) Me.rdoTwoColumns.Name = "rdoTwoColumns" Me.rdoTwoColumns.Size = New System.Drawing.Size(88, 17) - Me.rdoTwoColumns.TabIndex = 2 + Me.rdoTwoColumns.TabIndex = 0 Me.rdoTwoColumns.Tag = "Two_columns" Me.rdoTwoColumns.Text = "Two columns" Me.rdoTwoColumns.UseVisualStyleBackColor = True @@ -62,7 +62,7 @@ Partial Class dlgCorrelation Me.rdoMultipleColumns.Location = New System.Drawing.Point(278, 12) Me.rdoMultipleColumns.Name = "rdoMultipleColumns" Me.rdoMultipleColumns.Size = New System.Drawing.Size(103, 17) - Me.rdoMultipleColumns.TabIndex = 3 + Me.rdoMultipleColumns.TabIndex = 1 Me.rdoMultipleColumns.Tag = "Multiple_columns" Me.rdoMultipleColumns.Text = "Multiple columns" Me.rdoMultipleColumns.UseVisualStyleBackColor = True @@ -73,7 +73,7 @@ Partial Class dlgCorrelation Me.lblFirstColumn.Location = New System.Drawing.Point(307, 118) Me.lblFirstColumn.Name = "lblFirstColumn" Me.lblFirstColumn.Size = New System.Drawing.Size(63, 13) - Me.lblFirstColumn.TabIndex = 7 + Me.lblFirstColumn.TabIndex = 4 Me.lblFirstColumn.Tag = "First_column" Me.lblFirstColumn.Text = "First column" ' @@ -83,7 +83,7 @@ Partial Class dlgCorrelation Me.lblSecondColumn.Location = New System.Drawing.Point(308, 169) Me.lblSecondColumn.Name = "lblSecondColumn" Me.lblSecondColumn.Size = New System.Drawing.Size(81, 13) - Me.lblSecondColumn.TabIndex = 8 + Me.lblSecondColumn.TabIndex = 6 Me.lblSecondColumn.Tag = "Second_column" Me.lblSecondColumn.Text = "Second column" ' @@ -95,7 +95,7 @@ Partial Class dlgCorrelation Me.grpMethod.Location = New System.Drawing.Point(3, 233) Me.grpMethod.Name = "grpMethod" Me.grpMethod.Size = New System.Drawing.Size(423, 44) - Me.grpMethod.TabIndex = 9 + Me.grpMethod.TabIndex = 8 Me.grpMethod.TabStop = False Me.grpMethod.Tag = "Method" Me.grpMethod.Text = "Method" @@ -140,7 +140,7 @@ Partial Class dlgCorrelation Me.cmdPlot.Location = New System.Drawing.Point(332, 293) Me.cmdPlot.Name = "cmdPlot" Me.cmdPlot.Size = New System.Drawing.Size(75, 23) - Me.cmdPlot.TabIndex = 11 + Me.cmdPlot.TabIndex = 10 Me.cmdPlot.Tag = "Plot" Me.cmdPlot.Text = "Plot" Me.cmdPlot.UseVisualStyleBackColor = True @@ -152,7 +152,7 @@ Partial Class dlgCorrelation Me.grpMissing.Location = New System.Drawing.Point(3, 283) Me.grpMissing.Name = "grpMissing" Me.grpMissing.Size = New System.Drawing.Size(309, 40) - Me.grpMissing.TabIndex = 12 + Me.grpMissing.TabIndex = 9 Me.grpMissing.TabStop = False Me.grpMissing.Tag = "Missing" Me.grpMissing.Text = "Missing" @@ -187,7 +187,7 @@ Partial Class dlgCorrelation Me.lblConfInterval.Location = New System.Drawing.Point(12, 325) Me.lblConfInterval.Name = "lblConfInterval" Me.lblConfInterval.Size = New System.Drawing.Size(133, 13) - Me.lblConfInterval.TabIndex = 13 + Me.lblConfInterval.TabIndex = 11 Me.lblConfInterval.Text = "T Test Confidence Interval" ' 'txtConfidenceInterval @@ -195,7 +195,7 @@ Partial Class dlgCorrelation Me.txtConfidenceInterval.Location = New System.Drawing.Point(156, 322) Me.txtConfidenceInterval.Name = "txtConfidenceInterval" Me.txtConfidenceInterval.Size = New System.Drawing.Size(100, 20) - Me.txtConfidenceInterval.TabIndex = 14 + Me.txtConfidenceInterval.TabIndex = 12 ' 'ucrReceiverMultipleColumns ' @@ -203,7 +203,7 @@ Partial Class dlgCorrelation Me.ucrReceiverMultipleColumns.Name = "ucrReceiverMultipleColumns" Me.ucrReceiverMultipleColumns.Selector = Nothing Me.ucrReceiverMultipleColumns.Size = New System.Drawing.Size(121, 104) - Me.ucrReceiverMultipleColumns.TabIndex = 15 + Me.ucrReceiverMultipleColumns.TabIndex = 3 ' 'ucrReceiverSecondColumn ' @@ -211,7 +211,7 @@ Partial Class dlgCorrelation Me.ucrReceiverSecondColumn.Name = "ucrReceiverSecondColumn" Me.ucrReceiverSecondColumn.Selector = Nothing Me.ucrReceiverSecondColumn.Size = New System.Drawing.Size(106, 26) - Me.ucrReceiverSecondColumn.TabIndex = 6 + Me.ucrReceiverSecondColumn.TabIndex = 7 ' 'ucrReceiverFirstColumn ' @@ -226,14 +226,14 @@ Partial Class dlgCorrelation Me.ucrSelectorDataFrameVarAddRemove.Location = New System.Drawing.Point(3, 37) Me.ucrSelectorDataFrameVarAddRemove.Name = "ucrSelectorDataFrameVarAddRemove" Me.ucrSelectorDataFrameVarAddRemove.Size = New System.Drawing.Size(242, 179) - Me.ucrSelectorDataFrameVarAddRemove.TabIndex = 4 + Me.ucrSelectorDataFrameVarAddRemove.TabIndex = 2 ' 'ucrBase ' Me.ucrBase.Location = New System.Drawing.Point(11, 358) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(409, 57) - Me.ucrBase.TabIndex = 1 + Me.ucrBase.TabIndex = 13 ' 'dlgCorrelation ' diff --git a/instat/dlgCorrelation.vb b/instat/dlgCorrelation.vb index 3be993590ef..f457b5e69bc 100644 --- a/instat/dlgCorrelation.vb +++ b/instat/dlgCorrelation.vb @@ -37,37 +37,32 @@ Public Class dlgCorrelation SetDefaults() bFirstLoad = False End If - - If bIsTwoColumnFunction Then - TestOKEnabledForTwoColumns() - Else - TestOKEnabledForMultipleColumns() - End If - + TestOKEnabled() End Sub Private Sub SetDefaults() ucrSelectorDataFrameVarAddRemove.Reset() ucrSelectorDataFrameVarAddRemove.Focus() + ' ucrReceiverFirstColumn.Focus() rdoPearson.Checked = True rdoTwoColumns.Checked = True sdgCorrPlot.SetDefaults() - TestOKEnabledForTwoColumns() + TestOKEnabled() End Sub Private Sub ucrReceiverFirstColumn_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverFirstColumn.SelectionChanged ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverFirstColumn.GetVariables()) - TestOKEnabledForTwoColumns() + TestOKEnabled() End Sub Private Sub ucrReceiverSecondColumn_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverSecondColumn.SelectionChanged ucrBase.clsRsyntax.AddParameter("y", clsRFunctionParameter:=ucrReceiverSecondColumn.GetVariables()) - TestOKEnabledForTwoColumns() + TestOKEnabled() End Sub Public Sub ucrReceiverMultipleColumns_SelectionChanged() Handles ucrReceiverMultipleColumns.SelectionChanged ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverMultipleColumns.GetVariables()) - TestOKEnabledForMultipleColumns() + TestOKEnabled() End Sub 'put all rdo button checked changed in one sub to make it shorter @@ -174,26 +169,20 @@ Public Class dlgCorrelation sdgCorrPlot.ShowDialog() End Sub - Private Sub TestOKEnabledForTwoColumns() - If ucrReceiverFirstColumn.IsEmpty() = False And ucrReceiverSecondColumn.IsEmpty() = False And (rdoPearson.Checked = True Or rdoKendall.Checked = True Or rdoSpearman.Checked = True) Then - ucrBase.OKEnabled(True) - Else - ucrBase.OKEnabled(False) - End If - End Sub - - Private Sub TestOKEnabledForMultipleColumns() - If ucrReceiverMultipleColumns.IsEmpty() = False And ucrReceiverMultipleColumns.lstSelectedVariables.Items.Count > 1 And (rdoCompleteRowsOnly.Checked = True Or rdoPairwise.Checked = True) AndAlso (rdoPearson.Checked = True Or rdoKendall.Checked = True Or rdoSpearman.Checked = True) Then - ucrBase.OKEnabled(True) + Private Sub TestOKEnabled() + If (rdoTwoColumns.Checked = True) Then + If ucrReceiverFirstColumn.IsEmpty() = False And ucrReceiverSecondColumn.IsEmpty() = False And (rdoPearson.Checked = True Or rdoKendall.Checked = True Or rdoSpearman.Checked = True) Then + ucrBase.OKEnabled(True) + End If + ElseIf (rdoMultipleColumns.Checked = True) Then + If ucrReceiverMultipleColumns.IsEmpty() = False And ucrReceiverMultipleColumns.lstSelectedVariables.Items.Count > 1 And (rdoCompleteRowsOnly.Checked = True Or rdoPairwise.Checked = True) AndAlso (rdoPearson.Checked = True Or rdoKendall.Checked = True Or rdoSpearman.Checked = True) Then + ucrBase.OKEnabled(True) + End If Else ucrBase.OKEnabled(False) End If End Sub - Private Sub ucrReceiverMultipleColumns_Load(sender As Object, e As EventArgs) Handles ucrReceiverMultipleColumns.Load - - End Sub - Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk sdgCorrPlot.RegOptions() End Sub From c0f25f54c3e5748cb262dd26e2e596959be1c824 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Mon, 7 Mar 2016 15:54:52 +0300 Subject: [PATCH 6/6] Fixing correlation dialogue and subdialogue --- instat/dlgCorrelation.vb | 10 ++++++++- instat/sdgCorrPlot.Designer.vb | 40 +++++++++++++++++----------------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/instat/dlgCorrelation.vb b/instat/dlgCorrelation.vb index f457b5e69bc..d858c1d7f1e 100644 --- a/instat/dlgCorrelation.vb +++ b/instat/dlgCorrelation.vb @@ -124,6 +124,7 @@ Public Class dlgCorrelation ucrBase.clsRsyntax.AddParameter("alternative", Chr(34) & "two.sided" & Chr(34)) ucrBase.clsRsyntax.AddParameter("exact", "NULL") bIsTwoColumnFunction = True + TestOKEnabled() End Sub Private Sub SetMultipleColumnAsFunction() @@ -147,6 +148,7 @@ Public Class dlgCorrelation SetUseParameter() ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverMultipleColumns.GetVariables()) bIsTwoColumnFunction = False + TestOKEnabled() End Sub Private Sub ColumnTypeChanged(sender As Object, e As EventArgs) Handles rdoTwoColumns.CheckedChanged, rdoMultipleColumns.CheckedChanged @@ -173,10 +175,14 @@ Public Class dlgCorrelation If (rdoTwoColumns.Checked = True) Then If ucrReceiverFirstColumn.IsEmpty() = False And ucrReceiverSecondColumn.IsEmpty() = False And (rdoPearson.Checked = True Or rdoKendall.Checked = True Or rdoSpearman.Checked = True) Then ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) End If ElseIf (rdoMultipleColumns.Checked = True) Then If ucrReceiverMultipleColumns.IsEmpty() = False And ucrReceiverMultipleColumns.lstSelectedVariables.Items.Count > 1 And (rdoCompleteRowsOnly.Checked = True Or rdoPairwise.Checked = True) AndAlso (rdoPearson.Checked = True Or rdoKendall.Checked = True Or rdoSpearman.Checked = True) Then ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) End If Else ucrBase.OKEnabled(False) @@ -184,6 +190,8 @@ Public Class dlgCorrelation End Sub Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk - sdgCorrPlot.RegOptions() + If (rdoMultipleColumns.Checked) Then + sdgCorrPlot.RegOptions() + End If End Sub End Class \ No newline at end of file diff --git a/instat/sdgCorrPlot.Designer.vb b/instat/sdgCorrPlot.Designer.vb index 2b61ed52e7e..583c0e6c2ec 100644 --- a/instat/sdgCorrPlot.Designer.vb +++ b/instat/sdgCorrPlot.Designer.vb @@ -22,21 +22,21 @@ Partial Class sdgCorrPlot 'Do not modify it using the code editor. _ Private Sub InitializeComponent() - Me.UcrButtonsSubdialogue1 = New instat.ucrButtonsSubdialogue() + Me.ucrBaseSdgCorrPlot = New instat.ucrButtonsSubdialogue() Me.tbGraphics = New System.Windows.Forms.TabPage() + Me.chkGGcorr = New System.Windows.Forms.CheckBox() Me.chkGGPairs = New System.Windows.Forms.CheckBox() Me.tbSdgCorrelation = New System.Windows.Forms.TabControl() - Me.chkGGcorr = New System.Windows.Forms.CheckBox() Me.tbGraphics.SuspendLayout() Me.tbSdgCorrelation.SuspendLayout() Me.SuspendLayout() ' - 'UcrButtonsSubdialogue1 + 'ucrBaseSdgCorrPlot ' - Me.UcrButtonsSubdialogue1.Location = New System.Drawing.Point(44, 228) - Me.UcrButtonsSubdialogue1.Name = "UcrButtonsSubdialogue1" - Me.UcrButtonsSubdialogue1.Size = New System.Drawing.Size(142, 30) - Me.UcrButtonsSubdialogue1.TabIndex = 0 + Me.ucrBaseSdgCorrPlot.Location = New System.Drawing.Point(44, 228) + Me.ucrBaseSdgCorrPlot.Name = "ucrBaseSdgCorrPlot" + Me.ucrBaseSdgCorrPlot.Size = New System.Drawing.Size(142, 30) + Me.ucrBaseSdgCorrPlot.TabIndex = 0 ' 'tbGraphics ' @@ -51,6 +51,17 @@ Partial Class sdgCorrPlot Me.tbGraphics.Text = "Graphics" Me.tbGraphics.UseVisualStyleBackColor = True ' + 'chkGGcorr + ' + Me.chkGGcorr.AutoSize = True + Me.chkGGcorr.Location = New System.Drawing.Point(28, 54) + Me.chkGGcorr.Name = "chkGGcorr" + Me.chkGGcorr.Size = New System.Drawing.Size(63, 17) + Me.chkGGcorr.TabIndex = 1 + Me.chkGGcorr.Tag = "GG_corr" + Me.chkGGcorr.Text = "GG corr" + Me.chkGGcorr.UseVisualStyleBackColor = True + ' 'chkGGPairs ' Me.chkGGPairs.AutoSize = True @@ -72,24 +83,13 @@ Partial Class sdgCorrPlot Me.tbSdgCorrelation.TabIndex = 1 Me.tbSdgCorrelation.Tag = "" ' - 'chkGGcorr - ' - Me.chkGGcorr.AutoSize = True - Me.chkGGcorr.Location = New System.Drawing.Point(28, 54) - Me.chkGGcorr.Name = "chkGGcorr" - Me.chkGGcorr.Size = New System.Drawing.Size(63, 17) - Me.chkGGcorr.TabIndex = 1 - Me.chkGGcorr.Tag = "GG_corr" - Me.chkGGcorr.Text = "GG corr" - Me.chkGGcorr.UseVisualStyleBackColor = True - ' 'sdgCorrPlot ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(227, 261) Me.Controls.Add(Me.tbSdgCorrelation) - Me.Controls.Add(Me.UcrButtonsSubdialogue1) + Me.Controls.Add(Me.ucrBaseSdgCorrPlot) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.Name = "sdgCorrPlot" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen @@ -102,7 +102,7 @@ Partial Class sdgCorrPlot End Sub - Friend WithEvents UcrButtonsSubdialogue1 As ucrButtonsSubdialogue + Friend WithEvents ucrBaseSdgCorrPlot As ucrButtonsSubdialogue Friend WithEvents tbGraphics As TabPage Friend WithEvents chkGGPairs As CheckBox Friend WithEvents tbSdgCorrelation As TabControl