From abe750b1d95882ca2779fcfe3481847f7991e559 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Mon, 10 Oct 2016 17:37:09 +0300 Subject: [PATCH 01/13] Changes on the specify origin option --- instat/dlgMakeDate.vb | 227 ++++++++++++++++++++++-------------------- 1 file changed, 119 insertions(+), 108 deletions(-) diff --git a/instat/dlgMakeDate.vb b/instat/dlgMakeDate.vb index d0a4e901d0b..3f071430a99 100644 --- a/instat/dlgMakeDate.vb +++ b/instat/dlgMakeDate.vb @@ -16,18 +16,17 @@ Imports instat.Translations Public Class dlgMakeDate - Public clsPaste As New RFunction Public bFirstLoad As Boolean = True Private Sub ucrSeclectorMakeDate_Load(sender As Object, e As EventArgs) Handles ucrSeclectorMakeDate.Load If bFirstLoad Then - InitialiseDialog() + InitialiseDialog() SetDefaults() - bFirstLoad = False - Else - ReopenDialog() - End If - TestOKEnabled() - autoTranslate(Me) + bFirstLoad = False + Else + ReopenDialog() + End If + TestOKEnabled() + autoTranslate(Me) End Sub @@ -42,12 +41,16 @@ Public Class dlgMakeDate ucrInputDay.SetItems({"%d (1-31)", "%j (1-366)"}) ucrInputComboBoxMonthTwo.SetItems({"365/366", "366"}) ucrInputComboBoxYearTwo.SetItems({"4 digits", "2 digits"}) - ucrInputFormat.SetItems({"%Y-%m-%d", "%Y/%m/%d", "%d%m%Y"}) + ucrInputFormat.SetItems({"%Y-%m-%d", "%d/%m/%Y", "%d%m%Y"}) ucrInputComboBoxTearThree.SetItems({"4 digits", "2 digits"}) - ucrInputOrigin.SetItems({"30-12-1899 (Excel)", "01-03-1600 (Gregorian)"}) + ucrInputOrigin.SetItems({"1899-12-30 (Excel)", "1600-03-01 (Gregorian)"}) + ucrReceiverForDate.Selector = ucrSeclectorMakeDate + ucrReceiverYearTwo.Selector = ucrSeclectorMakeDate + ucrReceiverDayTwo.Selector = ucrSeclectorMakeDate + ucrReceiverYearThree.Selector = ucrSeclectorMakeDate + ucrReceiverMonthThree.Selector = ucrSeclectorMakeDate + ucrReceiverDayThree.Selector = ucrSeclectorMakeDate - ucrBase.clsRsyntax.SetFunction("as.Date") - ucrBase.clsRsyntax.AddParameter("x") End Sub Private Sub SetDefaults() @@ -56,7 +59,7 @@ Public Class dlgMakeDate ucrInputNewColumnName.Reset() ucrSeclectorMakeDate.Reset() ucrInputFormat.Reset() - ucrInputFormat.SetName("%Y-%m-%d") + ucrInputFormat.SetName("%d/%m/%Y") ucrInputSeparator.SetName("/") ucrInputYear.SetName("%Y (4 digits)") ucrInputMonth.SetName("%m (1-12)") @@ -64,13 +67,12 @@ Public Class dlgMakeDate ucrInputComboBoxTearThree.SetName("4 digits (eg 1920)") ucrInputComboBoxMonthTwo.SetName("365/366") ucrInputComboBoxYearTwo.SetName("4 digits (eg 1920)") - ucrInputOrigin.SetName("30-12-1899 (Excel)") + ucrInputOrigin.SetName("1899-12-30 (Excel)") grpFormatField.Visible = False ucrInputOrigin.Visible = False ucrInputNewColumnName.SetPrefix("Date") TestOKEnabled() rdoSingleColumn.Checked = True - ShowGroups() End Sub Private Sub TestOKEnabled() If ((Not ucrReceiverForDate.IsEmpty) OrElse ((Not ucrReceiverYearTwo.IsEmpty) AndAlso (Not ucrReceiverDayTwo.IsEmpty)) OrElse ((Not ucrReceiverDayThree.IsEmpty) AndAlso (Not ucrReceiverMonthThree.IsEmpty) AndAlso (Not ucrReceiverYearThree.IsEmpty))) Then @@ -98,88 +100,18 @@ Public Class dlgMakeDate Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() End Sub - Private Sub ucrReceiverForDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverForDate.SelectionChanged - DateCols() + Private Sub ucrReceiverForDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverForDate.SelectionChanged, ucrReceiverDayThree.SelectionChanged, ucrReceiverDayTwo.SelectionChanged, ucrReceiverMonthThree.SelectionChanged, ucrReceiverYearThree.SelectionChanged, ucrReceiverYearTwo.SelectionChanged + Formats() TestOKEnabled() End Sub - Private Sub DateCols() - If rdoSingleColumn.Checked Then - If Not ucrReceiverForDate.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverForDate.GetVariables()) - - Else - ucrBase.clsRsyntax.RemoveParameter("x") - End If - ElseIf rdoYearandDayofYear.Checked Then - - Else - - If Not ucrReceiverMonthThree.IsEmpty AndAlso Not ucrReceiverDayThree.IsEmpty AndAlso Not ucrReceiverYearThree.IsEmpty Then - - clsPaste.SetRCommand("paste") - clsPaste.AddParameter("sep", Chr(34) & "" & Chr(34)) - clsPaste.AddParameter("x") - End If - End If - End Sub - - Private Sub ucrReceiverForDate_Load(sender As Object, e As EventArgs) - - End Sub - - Private Sub rdoSingleColumn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSingleColumn.CheckedChanged, rdoYearandDayofYear.CheckedChanged, rdoYearMonthDay.CheckedChanged - ShowGroups() - End Sub - - Private Sub ShowGroups() - If rdoSingleColumn.Checked Then - ucrReceiverForDate.Selector = ucrSeclectorMakeDate - ucrReceiverForDate.SetMeAsReceiver() - grpSingleColumn.Visible = True - grpTwoColumns.Visible = False - grpThreeColumns.Visible = False - ElseIf rdoYearandDayofYear.Checked Then - ucrReceiverYearTwo.Selector = ucrSeclectorMakeDate - ucrReceiverDayTwo.Selector = ucrSeclectorMakeDate - ucrReceiverYearTwo.SetMeAsReceiver() - grpTwoColumns.Visible = True - grpThreeColumns.Visible = False - grpSingleColumn.Visible = False - Else - ucrReceiverYearThree.Selector = ucrSeclectorMakeDate - ucrReceiverMonthThree.Selector = ucrSeclectorMakeDate - ucrReceiverDayThree.Selector = ucrSeclectorMakeDate - ucrReceiverYearThree.SetMeAsReceiver() - grpThreeColumns.Visible = True - grpTwoColumns.Visible = False - grpSingleColumn.Visible = False - End If - End Sub - Private Sub ShowOrigin() - If rdoSpecifyOrigin.Checked Then - ucrInputOrigin.Visible = True - Else - ucrInputOrigin.Visible = False - End If - End Sub - - Private Sub showFormat() - If chkMore.Checked Then - grpFormatField.Visible = True - Else - grpFormatField.Visible = False - End If - End Sub - - Private Sub rdoSpecifyOrigin_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSpecifyOrigin.CheckedChanged, rdoSpecifyFormat.CheckedChanged - ShowOrigin() + Private Sub rdoSingleColumn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSingleColumn.CheckedChanged, rdoYearandDayofYear.CheckedChanged, rdoYearMonthDay.CheckedChanged, rdoSpecifyOrigin.CheckedChanged, rdoSpecifyFormat.CheckedChanged, rdoDefaultFormat.CheckedChanged Formats() + TestOKEnabled() End Sub - Private Sub chkMore_CheckedChanged(sender As Object, e As EventArgs) Handles chkMore.CheckedChanged - showFormat() + Formats() End Sub Private Sub ucrInputSpecifyDates_NameChanged() Handles ucrInputFormat.NameChanged @@ -187,7 +119,7 @@ Public Class dlgMakeDate End Sub Private Sub ucrSeclectorMakeDate_DataFrameChanged() Handles ucrSeclectorMakeDate.DataFrameChanged - + Formats() End Sub @@ -196,32 +128,111 @@ Public Class dlgMakeDate End Sub Private Sub Formats() - If rdoSpecifyOrigin.Checked Then - ucrInputFormat.Visible = False - ucrBase.clsRsyntax.RemoveParameter("format") - If Not ucrInputOrigin.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & ucrInputOrigin.GetText & Chr(34)) + If rdoSingleColumn.Checked Then + + ucrReceiverForDate.SetMeAsReceiver() + grpSingleColumn.Visible = True + grpTwoColumns.Visible = False + grpThreeColumns.Visible = False + ucrBase.clsRsyntax.SetFunction("as.Date") + If chkMore.Checked Then + grpFormatField.Visible = True Else - ucrBase.clsRsyntax.RemoveParameter("origin") + grpFormatField.Visible = False + End If + If Not ucrReceiverForDate.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverForDate.GetVariables()) + Else + ucrBase.clsRsyntax.RemoveParameter("x") End If - ElseIf rdoSpecifyFormat.Checked Then - ucrBase.clsRsyntax.RemoveParameter("origin") - ucrInputFormat.Visible = True - If Not ucrInputFormat.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("format", Chr(34) & ucrInputFormat.GetText & Chr(34)) + If rdoSpecifyOrigin.Checked Then + ucrReceiverForDate.SetIncludedDataTypes({"numeric"}) + ucrInputFormat.Visible = False + ucrInputOrigin.Visible = True + ucrBase.clsRsyntax.RemoveParameter("format") + If Not ucrInputOrigin.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & ucrInputOrigin.GetText & Chr(34)) + Else + ucrBase.clsRsyntax.RemoveParameter("origin") + + + End If + ElseIf rdoSpecifyFormat.Checked Then + ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) + + ucrBase.clsRsyntax.RemoveParameter("origin") + ucrInputFormat.Visible = True + ucrInputOrigin.Visible = False + + If Not ucrInputFormat.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("format", Chr(34) & ucrInputFormat.GetText & Chr(34)) + Else + ucrBase.clsRsyntax.RemoveParameter("format") + End If Else + ucrInputOrigin.Visible = False + ucrInputFormat.Visible = False + ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) ucrBase.clsRsyntax.RemoveParameter("format") + ucrBase.clsRsyntax.RemoveParameter("origin") + End If + ucrBase.clsRsyntax.RemoveParameter("year") + ucrBase.clsRsyntax.RemoveParameter("doy") + ucrBase.clsRsyntax.RemoveParameter("month") + ucrBase.clsRsyntax.RemoveParameter("day") + ucrBase.clsRsyntax.RemoveParameter("data_name") + ElseIf rdoYearandDayofYear.Checked Then + ucrReceiverYearTwo.SetMeAsReceiver() + ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSeclectorMakeDate.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + ucrBase.clsRsyntax.RemoveParameter("x") + ucrBase.clsRsyntax.RemoveParameter("format") + ucrBase.clsRsyntax.RemoveParameter("origin") + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$make_date_yeardoy") + grpTwoColumns.Visible = True + grpThreeColumns.Visible = False + grpSingleColumn.Visible = False + + If ucrReceiverYearTwo.IsEmpty = False Then + ucrBase.clsRsyntax.AddParameter("year", ucrReceiverYearTwo.GetVariableNames()) + Else + ucrBase.clsRsyntax.RemoveParameter("year") + End If + If ucrReceiverDayTwo.IsEmpty = False Then + ucrBase.clsRsyntax.AddParameter("doy", ucrReceiverDayTwo.GetVariableNames()) + Else + ucrBase.clsRsyntax.RemoveParameter("doy") End If + ucrBase.clsRsyntax.RemoveParameter("month") + ucrBase.clsRsyntax.RemoveParameter("day") Else - ucrInputFormat.Visible = False + ucrReceiverYearThree.SetMeAsReceiver() + ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSeclectorMakeDate.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + ucrBase.clsRsyntax.RemoveParameter("doy") + ucrBase.clsRsyntax.RemoveParameter("year") + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$make_date_yearmonthday") + If Not ucrReceiverYearThree.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("year", ucrReceiverYearThree.GetVariableNames()) + Else + ucrBase.clsRsyntax.RemoveParameter("year") + End If + If ucrReceiverMonthThree.IsEmpty = False Then + ucrBase.clsRsyntax.AddParameter("month", ucrReceiverMonthThree.GetVariableNames()) + Else + ucrBase.clsRsyntax.RemoveParameter("month") + End If + If ucrReceiverDayThree.IsEmpty = False Then + ucrBase.clsRsyntax.AddParameter("day", ucrReceiverDayThree.GetVariableNames()) + Else + ucrBase.clsRsyntax.RemoveParameter("day") + End If + grpThreeColumns.Visible = True + grpTwoColumns.Visible = False + grpSingleColumn.Visible = False + ucrBase.clsRsyntax.RemoveParameter("x") ucrBase.clsRsyntax.RemoveParameter("format") ucrBase.clsRsyntax.RemoveParameter("origin") End If End Sub -End Class - - - - +End Class \ No newline at end of file From ca032a9e6fdc167601f97239f9542c3dd21ae2ea Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 11 Oct 2016 15:38:40 +0300 Subject: [PATCH 02/13] #Change on specify origin - date format --- instat/dlgMakeDate.vb | 240 +++++++++++++++++++++--------------------- 1 file changed, 119 insertions(+), 121 deletions(-) diff --git a/instat/dlgMakeDate.vb b/instat/dlgMakeDate.vb index 3f071430a99..16d78b15f41 100644 --- a/instat/dlgMakeDate.vb +++ b/instat/dlgMakeDate.vb @@ -16,17 +16,18 @@ Imports instat.Translations Public Class dlgMakeDate + Public clsPaste As New RFunction Public bFirstLoad As Boolean = True Private Sub ucrSeclectorMakeDate_Load(sender As Object, e As EventArgs) Handles ucrSeclectorMakeDate.Load If bFirstLoad Then - InitialiseDialog() + InitialiseDialog() SetDefaults() - bFirstLoad = False - Else - ReopenDialog() - End If - TestOKEnabled() - autoTranslate(Me) + bFirstLoad = False + Else + ReopenDialog() + End If + TestOKEnabled() + autoTranslate(Me) End Sub @@ -41,16 +42,12 @@ Public Class dlgMakeDate ucrInputDay.SetItems({"%d (1-31)", "%j (1-366)"}) ucrInputComboBoxMonthTwo.SetItems({"365/366", "366"}) ucrInputComboBoxYearTwo.SetItems({"4 digits", "2 digits"}) - ucrInputFormat.SetItems({"%Y-%m-%d", "%d/%m/%Y", "%d%m%Y"}) + ucrInputFormat.SetItems({"%Y-%m-%d", "%Y/%m/%d", "%d%m%Y"}) ucrInputComboBoxTearThree.SetItems({"4 digits", "2 digits"}) - ucrInputOrigin.SetItems({"1899-12-30 (Excel)", "1600-03-01 (Gregorian)"}) - ucrReceiverForDate.Selector = ucrSeclectorMakeDate - ucrReceiverYearTwo.Selector = ucrSeclectorMakeDate - ucrReceiverDayTwo.Selector = ucrSeclectorMakeDate - ucrReceiverYearThree.Selector = ucrSeclectorMakeDate - ucrReceiverMonthThree.Selector = ucrSeclectorMakeDate - ucrReceiverDayThree.Selector = ucrSeclectorMakeDate + ucrInputOrigin.SetItems({"30-12-1899 (Excel)", "01-03-1600 (Gregorian)"}) + ucrBase.clsRsyntax.SetFunction("as.Date") + ucrBase.clsRsyntax.AddParameter("x") End Sub Private Sub SetDefaults() @@ -59,7 +56,7 @@ Public Class dlgMakeDate ucrInputNewColumnName.Reset() ucrSeclectorMakeDate.Reset() ucrInputFormat.Reset() - ucrInputFormat.SetName("%d/%m/%Y") + ucrInputFormat.SetName("%Y-%m-%d") ucrInputSeparator.SetName("/") ucrInputYear.SetName("%Y (4 digits)") ucrInputMonth.SetName("%m (1-12)") @@ -67,12 +64,13 @@ Public Class dlgMakeDate ucrInputComboBoxTearThree.SetName("4 digits (eg 1920)") ucrInputComboBoxMonthTwo.SetName("365/366") ucrInputComboBoxYearTwo.SetName("4 digits (eg 1920)") - ucrInputOrigin.SetName("1899-12-30 (Excel)") + ucrInputOrigin.SetName("30-12-1899 (Excel)") grpFormatField.Visible = False ucrInputOrigin.Visible = False ucrInputNewColumnName.SetPrefix("Date") TestOKEnabled() rdoSingleColumn.Checked = True + ShowGroups() End Sub Private Sub TestOKEnabled() If ((Not ucrReceiverForDate.IsEmpty) OrElse ((Not ucrReceiverYearTwo.IsEmpty) AndAlso (Not ucrReceiverDayTwo.IsEmpty)) OrElse ((Not ucrReceiverDayThree.IsEmpty) AndAlso (Not ucrReceiverMonthThree.IsEmpty) AndAlso (Not ucrReceiverYearThree.IsEmpty))) Then @@ -81,6 +79,14 @@ Public Class dlgMakeDate ucrBase.OKEnabled(False) End If End Sub + Private Sub DateFormat() + Select Case ucrInputOrigin.GetText + Case "30-12-1899 (Excel)" + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1899-12-30(Excel)" & Chr(34)) + Case Else + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1600-01-03 (Gregorian)" & Chr(34)) + End Select + End Sub Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk If Not ucrInputFormat.cboInput.Items.Contains(ucrInputFormat.GetText) Then @@ -100,18 +106,88 @@ Public Class dlgMakeDate Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() End Sub - Private Sub ucrReceiverForDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverForDate.SelectionChanged, ucrReceiverDayThree.SelectionChanged, ucrReceiverDayTwo.SelectionChanged, ucrReceiverMonthThree.SelectionChanged, ucrReceiverYearThree.SelectionChanged, ucrReceiverYearTwo.SelectionChanged - Formats() + Private Sub ucrReceiverForDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverForDate.SelectionChanged + DateCols() TestOKEnabled() End Sub - Private Sub rdoSingleColumn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSingleColumn.CheckedChanged, rdoYearandDayofYear.CheckedChanged, rdoYearMonthDay.CheckedChanged, rdoSpecifyOrigin.CheckedChanged, rdoSpecifyFormat.CheckedChanged, rdoDefaultFormat.CheckedChanged + Private Sub DateCols() + If rdoSingleColumn.Checked Then + If Not ucrReceiverForDate.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverForDate.GetVariables()) + + Else + ucrBase.clsRsyntax.RemoveParameter("x") + End If + ElseIf rdoYearandDayofYear.Checked Then + + Else + + If Not ucrReceiverMonthThree.IsEmpty AndAlso Not ucrReceiverDayThree.IsEmpty AndAlso Not ucrReceiverYearThree.IsEmpty Then + + clsPaste.SetRCommand("paste") + clsPaste.AddParameter("sep", Chr(34) & "" & Chr(34)) + clsPaste.AddParameter("x") + End If + End If + End Sub + + Private Sub ucrReceiverForDate_Load(sender As Object, e As EventArgs) + + End Sub + + Private Sub rdoSingleColumn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSingleColumn.CheckedChanged, rdoYearandDayofYear.CheckedChanged, rdoYearMonthDay.CheckedChanged + ShowGroups() + End Sub + + Private Sub ShowGroups() + If rdoSingleColumn.Checked Then + ucrReceiverForDate.Selector = ucrSeclectorMakeDate + ucrReceiverForDate.SetMeAsReceiver() + grpSingleColumn.Visible = True + grpTwoColumns.Visible = False + grpThreeColumns.Visible = False + ElseIf rdoYearandDayofYear.Checked Then + ucrReceiverYearTwo.Selector = ucrSeclectorMakeDate + ucrReceiverDayTwo.Selector = ucrSeclectorMakeDate + ucrReceiverYearTwo.SetMeAsReceiver() + grpTwoColumns.Visible = True + grpThreeColumns.Visible = False + grpSingleColumn.Visible = False + Else + ucrReceiverYearThree.Selector = ucrSeclectorMakeDate + ucrReceiverMonthThree.Selector = ucrSeclectorMakeDate + ucrReceiverDayThree.Selector = ucrSeclectorMakeDate + ucrReceiverYearThree.SetMeAsReceiver() + grpThreeColumns.Visible = True + grpTwoColumns.Visible = False + grpSingleColumn.Visible = False + End If + End Sub + Private Sub ShowOrigin() + If rdoSpecifyOrigin.Checked Then + ucrInputOrigin.Visible = True + Else + ucrInputOrigin.Visible = False + End If + End Sub + + Private Sub showFormat() + If chkMore.Checked Then + grpFormatField.Visible = True + Else + grpFormatField.Visible = False + End If + End Sub + + Private Sub rdoSpecifyOrigin_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSpecifyOrigin.CheckedChanged, rdoSpecifyFormat.CheckedChanged + ShowOrigin() Formats() - TestOKEnabled() End Sub + Private Sub chkMore_CheckedChanged(sender As Object, e As EventArgs) Handles chkMore.CheckedChanged - Formats() + showFormat() End Sub Private Sub ucrInputSpecifyDates_NameChanged() Handles ucrInputFormat.NameChanged @@ -119,120 +195,42 @@ Public Class dlgMakeDate End Sub Private Sub ucrSeclectorMakeDate_DataFrameChanged() Handles ucrSeclectorMakeDate.DataFrameChanged - Formats() + End Sub Private Sub ucrInputOrigin_NameChanged() Handles ucrInputOrigin.NameChanged Formats() + If Not ucrInputOrigin.IsEmpty Then + DateFormat() + Else + ucrBase.clsRsyntax.RemoveParameter("origin") + End If + End Sub Private Sub Formats() - If rdoSingleColumn.Checked Then - - ucrReceiverForDate.SetMeAsReceiver() - grpSingleColumn.Visible = True - grpTwoColumns.Visible = False - grpThreeColumns.Visible = False - ucrBase.clsRsyntax.SetFunction("as.Date") - If chkMore.Checked Then - grpFormatField.Visible = True - Else - grpFormatField.Visible = False - End If - If Not ucrReceiverForDate.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverForDate.GetVariables()) - - Else - ucrBase.clsRsyntax.RemoveParameter("x") - End If - If rdoSpecifyOrigin.Checked Then - ucrReceiverForDate.SetIncludedDataTypes({"numeric"}) - ucrInputFormat.Visible = False - ucrInputOrigin.Visible = True - ucrBase.clsRsyntax.RemoveParameter("format") - If Not ucrInputOrigin.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & ucrInputOrigin.GetText & Chr(34)) - Else - ucrBase.clsRsyntax.RemoveParameter("origin") - - - End If - ElseIf rdoSpecifyFormat.Checked Then - ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) - - ucrBase.clsRsyntax.RemoveParameter("origin") - ucrInputFormat.Visible = True - ucrInputOrigin.Visible = False - - If Not ucrInputFormat.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("format", Chr(34) & ucrInputFormat.GetText & Chr(34)) - Else - ucrBase.clsRsyntax.RemoveParameter("format") - End If - Else - ucrInputOrigin.Visible = False - ucrInputFormat.Visible = False - ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) - ucrBase.clsRsyntax.RemoveParameter("format") - ucrBase.clsRsyntax.RemoveParameter("origin") - End If - ucrBase.clsRsyntax.RemoveParameter("year") - ucrBase.clsRsyntax.RemoveParameter("doy") - ucrBase.clsRsyntax.RemoveParameter("month") - ucrBase.clsRsyntax.RemoveParameter("day") - ucrBase.clsRsyntax.RemoveParameter("data_name") - ElseIf rdoYearandDayofYear.Checked Then - ucrReceiverYearTwo.SetMeAsReceiver() - ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSeclectorMakeDate.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) - ucrBase.clsRsyntax.RemoveParameter("x") + If rdoSpecifyOrigin.Checked Then + ucrInputFormat.Visible = False ucrBase.clsRsyntax.RemoveParameter("format") - ucrBase.clsRsyntax.RemoveParameter("origin") - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$make_date_yeardoy") - grpTwoColumns.Visible = True - grpThreeColumns.Visible = False - grpSingleColumn.Visible = False - If ucrReceiverYearTwo.IsEmpty = False Then - ucrBase.clsRsyntax.AddParameter("year", ucrReceiverYearTwo.GetVariableNames()) - Else - ucrBase.clsRsyntax.RemoveParameter("year") - End If - If ucrReceiverDayTwo.IsEmpty = False Then - ucrBase.clsRsyntax.AddParameter("doy", ucrReceiverDayTwo.GetVariableNames()) + ElseIf rdoSpecifyFormat.Checked Then + ucrBase.clsRsyntax.RemoveParameter("origin") + ucrInputFormat.Visible = True + If Not ucrInputFormat.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("format", Chr(34) & ucrInputFormat.GetText & Chr(34)) Else - ucrBase.clsRsyntax.RemoveParameter("doy") + ucrBase.clsRsyntax.RemoveParameter("format") End If - ucrBase.clsRsyntax.RemoveParameter("month") - ucrBase.clsRsyntax.RemoveParameter("day") Else - ucrReceiverYearThree.SetMeAsReceiver() - ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSeclectorMakeDate.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) - ucrBase.clsRsyntax.RemoveParameter("doy") - ucrBase.clsRsyntax.RemoveParameter("year") - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$make_date_yearmonthday") - If Not ucrReceiverYearThree.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("year", ucrReceiverYearThree.GetVariableNames()) - Else - ucrBase.clsRsyntax.RemoveParameter("year") - End If - If ucrReceiverMonthThree.IsEmpty = False Then - ucrBase.clsRsyntax.AddParameter("month", ucrReceiverMonthThree.GetVariableNames()) - Else - ucrBase.clsRsyntax.RemoveParameter("month") - End If - If ucrReceiverDayThree.IsEmpty = False Then - ucrBase.clsRsyntax.AddParameter("day", ucrReceiverDayThree.GetVariableNames()) - Else - ucrBase.clsRsyntax.RemoveParameter("day") - End If - grpThreeColumns.Visible = True - grpTwoColumns.Visible = False - grpSingleColumn.Visible = False - ucrBase.clsRsyntax.RemoveParameter("x") + ucrInputFormat.Visible = False ucrBase.clsRsyntax.RemoveParameter("format") ucrBase.clsRsyntax.RemoveParameter("origin") End If End Sub +End Class + + + + -End Class \ No newline at end of file From d00bc781979b9ba411586ce7c9c84ae42be74a0a Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 11 Oct 2016 16:51:24 +0300 Subject: [PATCH 03/13] specify origin --- instat/dlgMakeDate.vb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/instat/dlgMakeDate.vb b/instat/dlgMakeDate.vb index 16d78b15f41..11b04a58888 100644 --- a/instat/dlgMakeDate.vb +++ b/instat/dlgMakeDate.vb @@ -81,10 +81,10 @@ Public Class dlgMakeDate End Sub Private Sub DateFormat() Select Case ucrInputOrigin.GetText - Case "30-12-1899 (Excel)" - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1899-12-30(Excel)" & Chr(34)) + Case "30-12-1899" + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1899-12-30)" & Chr(34)) Case Else - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1600-01-03 (Gregorian)" & Chr(34)) + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1600-01-03)" & Chr(34)) End Select End Sub From 4a195a3886508933a7e16dbfb7c7bce7fda1c3f7 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Wed, 12 Oct 2016 14:35:09 +0300 Subject: [PATCH 04/13] Make Date and Form main changes --- instat/dlgMakeDate.vb | 40 +++++++++++++++++++--------------------- instat/frmMain.vb | 4 ---- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/instat/dlgMakeDate.vb b/instat/dlgMakeDate.vb index 11b04a58888..15195c9f7c6 100644 --- a/instat/dlgMakeDate.vb +++ b/instat/dlgMakeDate.vb @@ -18,16 +18,16 @@ Imports instat.Translations Public Class dlgMakeDate Public clsPaste As New RFunction Public bFirstLoad As Boolean = True - Private Sub ucrSeclectorMakeDate_Load(sender As Object, e As EventArgs) Handles ucrSeclectorMakeDate.Load + Private Sub dlgMakeDate_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then - InitialiseDialog() + InitialiseDialog() SetDefaults() - bFirstLoad = False - Else - ReopenDialog() - End If - TestOKEnabled() - autoTranslate(Me) + bFirstLoad = False + Else + ReopenDialog() + End If + TestOKEnabled() + autoTranslate(Me) End Sub @@ -46,7 +46,7 @@ Public Class dlgMakeDate ucrInputComboBoxTearThree.SetItems({"4 digits", "2 digits"}) ucrInputOrigin.SetItems({"30-12-1899 (Excel)", "01-03-1600 (Gregorian)"}) - ucrBase.clsRsyntax.SetFunction("as.Date") + ucrBase.clsRsyntax.SetFunction("as.Date") ucrBase.clsRsyntax.AddParameter("x") End Sub @@ -81,14 +81,18 @@ Public Class dlgMakeDate End Sub Private Sub DateFormat() Select Case ucrInputOrigin.GetText - Case "30-12-1899" - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1899-12-30)" & Chr(34)) + Case "30-12-1899 (Excel)" + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1899-12-30" & Chr(34)) Case Else - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1600-01-03)" & Chr(34)) + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1600-01-03" & Chr(34)) End Select End Sub Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk + setHistory() + End Sub + + Private Sub setHistory() If Not ucrInputFormat.cboInput.Items.Contains(ucrInputFormat.GetText) Then ucrInputFormat.cboInput.Items.Insert(0, ucrInputFormat.GetText) Else @@ -132,10 +136,6 @@ Public Class dlgMakeDate End If End Sub - Private Sub ucrReceiverForDate_Load(sender As Object, e As EventArgs) - - End Sub - Private Sub rdoSingleColumn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSingleColumn.CheckedChanged, rdoYearandDayofYear.CheckedChanged, rdoYearMonthDay.CheckedChanged ShowGroups() End Sub @@ -194,11 +194,6 @@ Public Class dlgMakeDate Formats() End Sub - Private Sub ucrSeclectorMakeDate_DataFrameChanged() Handles ucrSeclectorMakeDate.DataFrameChanged - - End Sub - - Private Sub ucrInputOrigin_NameChanged() Handles ucrInputOrigin.NameChanged Formats() If Not ucrInputOrigin.IsEmpty Then @@ -211,10 +206,12 @@ Public Class dlgMakeDate Private Sub Formats() If rdoSpecifyOrigin.Checked Then + ucrReceiverForDate.SetIncludedDataTypes({"numeric"}) ucrInputFormat.Visible = False ucrBase.clsRsyntax.RemoveParameter("format") ElseIf rdoSpecifyFormat.Checked Then + ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) ucrBase.clsRsyntax.RemoveParameter("origin") ucrInputFormat.Visible = True If Not ucrInputFormat.IsEmpty Then @@ -224,6 +221,7 @@ Public Class dlgMakeDate End If Else ucrInputFormat.Visible = False + ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) ucrBase.clsRsyntax.RemoveParameter("format") ucrBase.clsRsyntax.RemoveParameter("origin") End If diff --git a/instat/frmMain.vb b/instat/frmMain.vb index 9d17a1837c1..5e8f50e7f50 100644 --- a/instat/frmMain.vb +++ b/instat/frmMain.vb @@ -1171,8 +1171,4 @@ Public Class frmMain Private Sub mnuOrganiseColumnMakeDate_Click(sender As Object, e As EventArgs) Handles mnuOrganiseColumnMakeDate.Click dlgMakeDate.ShowDialog() End Sub - - Private Sub mnuOrganiseColumnMakeDate_Click_1(sender As Object, e As EventArgs) Handles mnuOrganiseColumnMakeDate.Click - dlgMakeDate.ShowDialog() - End Sub End Class \ No newline at end of file From 50cef4d569839f9e3301f781ef7baa95469ae9f9 Mon Sep 17 00:00:00 2001 From: Lily Date: Wed, 12 Oct 2016 13:50:01 +0100 Subject: [PATCH 05/13] Added distributions --- instat/My Project/Resources.Designer.vb | 27 ++++++++++++++++++ instat/My Project/Resources.resx | 9 ++++++ instat/ucrDistributions.vb | 38 +++++++++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/instat/My Project/Resources.Designer.vb b/instat/My Project/Resources.Designer.vb index a871064b018..fca55383eb3 100644 --- a/instat/My Project/Resources.Designer.vb +++ b/instat/My Project/Resources.Designer.vb @@ -290,6 +290,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Beta. + ''' + Friend ReadOnly Property Beta() As String + Get + Return ResourceManager.GetString("Beta", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Binomial. ''' @@ -2298,6 +2307,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Negative Binomial. + ''' + Friend ReadOnly Property Negative_Binomial() As String + Get + Return ResourceManager.GetString("Negative_Binomial", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to New Column Name. ''' @@ -3696,6 +3714,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Students t. + ''' + Friend ReadOnly Property Students_t() As String + Get + Return ResourceManager.GetString("Students_t", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Submit. ''' diff --git a/instat/My Project/Resources.resx b/instat/My Project/Resources.resx index fb8934bc2c9..a1c9bad919f 100644 --- a/instat/My Project/Resources.resx +++ b/instat/My Project/Resources.resx @@ -1513,4 +1513,13 @@ Location + + Beta + + + Negative Binomial + + + Students t + \ No newline at end of file diff --git a/instat/ucrDistributions.vb b/instat/ucrDistributions.vb index 22b0179e173..5b8abe4d8a5 100644 --- a/instat/ucrDistributions.vb +++ b/instat/ucrDistributions.vb @@ -188,6 +188,9 @@ Public Class ucrDistributions Dim clsQuasiDist As New Distribution Dim clsQuasibinomialDist As New Distribution Dim clsQuasipoissonDist As New Distribution + Dim clsBetaDist As New Distribution + Dim clsNegBinomDist As New Distribution + Dim clsStudentsTDist As New Distribution ' Normal distribution clsNormalDist.strNameTag = "Normal" @@ -300,6 +303,40 @@ Public Class ucrDistributions clsPoissonDist.AddParameter("lambda", "Mean", 1) lstAllDistributions.Add(clsPoissonDist) + 'Beta Distribution + clsBetaDist.strNameTag = "Beta" + clsBetaDist.strRName = "beta" + clsBetaDist.strRFunctionName = "rbeta" + clsBetaDist.strPFunctionName = "pbeta" + clsBetaDist.strQFunctionName = "qbeta" + clsBetaDist.strDFunctionName = "dbeta" + clsBetaDist.bIsContinuous = True + clsBetaDist.AddParameter("shape1", "a", 1) + clsBetaDist.AddParameter("shape2", "b", 1) + lstAllDistributions.Add(clsBetaDist) + + 'Negative Binomial Distribution + clsNegBinomDist.strNameTag = "Negative_Binomial" + clsNegBinomDist.strRName = "nbinom" + clsNegBinomDist.strRFunctionName = "rnbinom" + clsNegBinomDist.strPFunctionName = "pnbinom" + clsNegBinomDist.strQFunctionName = "qnbinom" + clsNegBinomDist.strDFunctionName = "dnbinom" + clsNegBinomDist.bIsContinuous = False + clsNegBinomDist.AddParameter("size", "Number", 1) + clsNegBinomDist.AddParameter("prob", "Probability", 0.5) + lstAllDistributions.Add(clsNegBinomDist) + + 'T Distribution + ' clsStudentsTDist.strNameTag = "Students_t" + ' clsStudentsTDist.strRName = "t" + ' clsStudentsTDist.strRFunctionName = "rt" + ' clsStudentsTDist.strPFunctionName = "pt" + ' clsStudentsTDist.strQFunctionName = "qt" + ' clsStudentsTDist.strDFunctionName = "dt" + ' clsStudentsTDist.AddParameter("df", "DF", 1) + ' lstAllDistributions.Add(clsStudentsTDist) + ' von mises distribution clsVonnMisesDist.strNameTag = "von_mises" clsVonnMisesDist.strRName = "vonmises" @@ -412,6 +449,7 @@ Public Class ucrDistributions clsQuasipoissonDist.bPositiveInt = True lstAllDistributions.Add(clsQuasipoissonDist) + bDistributionsSet = True End Sub Public Event cboDistributionsIndexChanged(sender As Object, e As EventArgs) From 26f6b2acbdd4502fe084020770bb6184f8385ec1 Mon Sep 17 00:00:00 2001 From: Lily Date: Wed, 12 Oct 2016 15:43:02 +0100 Subject: [PATCH 06/13] A few clean up fixes to One Var Model --- instat/dlgOneVarFitModel.vb | 7 +++++-- instat/dlgOneVarUseModel.vb | 2 +- instat/sdgOneVarCompareModels.vb | 18 ------------------ instat/sdgOneVarFitModDisplay.vb | 1 - instat/sdgOneVarFitModel.vb | 10 ---------- instat/sdgOneVarUseModFit.Designer.vb | 20 +++++++++++++++----- instat/sdgOneVarUseModFit.vb | 10 +++++++--- 7 files changed, 28 insertions(+), 40 deletions(-) diff --git a/instat/dlgOneVarFitModel.vb b/instat/dlgOneVarFitModel.vb index ecff96ec89b..5ab64178769 100644 --- a/instat/dlgOneVarFitModel.vb +++ b/instat/dlgOneVarFitModel.vb @@ -121,9 +121,9 @@ Public Class dlgOneVarFitModel Private Sub chkSaveModel_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveModel.CheckedChanged If chkSaveModel.Checked Then - ucrSaveModel.Enabled = True + ucrSaveModel.Visible = True Else - ucrSaveModel.Enabled = False + ucrSaveModel.Visible = False End If AssignSaveModel() TestOKEnabled() @@ -171,6 +171,9 @@ Public Class dlgOneVarFitModel If sdgOneVarFitModel.rdoMle.Checked AndAlso (sdgOneVarFitModDisplay.rdoLoglik.Checked Or sdgOneVarFitModDisplay.rdoLik.Checked) Then sdgOneVarFitModDisplay.RunLikelihoods() End If + ' If Not sdgOneVarFitModel.rdoMle.Checked AndAlso (sdgOneVarFitModDisplay.rdoLoglik.Checked Or sdgOneVarFitModDisplay.rdoLik.Checked) Then + 'message to say likelihood won't be displayed + ' End If End Sub End Class \ No newline at end of file diff --git a/instat/dlgOneVarUseModel.vb b/instat/dlgOneVarUseModel.vb index c98e238546f..81403ccef4e 100644 --- a/instat/dlgOneVarUseModel.vb +++ b/instat/dlgOneVarUseModel.vb @@ -93,7 +93,7 @@ Public Class dlgOneVarUseModel End Sub Private Sub ucrSelector_DataFrameChanged() Handles ucrSelector.DataFrameChanged - ' AssignSaveModel() + AssignSavetoDataFrame() ' AssignSaveObjects() End Sub diff --git a/instat/sdgOneVarCompareModels.vb b/instat/sdgOneVarCompareModels.vb index 3a159d066e1..c7bb6ce59f0 100644 --- a/instat/sdgOneVarCompareModels.vb +++ b/instat/sdgOneVarCompareModels.vb @@ -124,23 +124,6 @@ Public Class sdgOneVarCompareModels End If End Sub - - ' To say if our models are discrete, we cannot use Density, QQ or PP - 'Private Sub SetPlotOptions() - 'If Not chosenmodels.bIsContinuous Then - ' chkDensity.Enabled = False - ' chkQQ.Enabled = False - ' rdoPPPlot.Enabled = False - 'If chkDensity.Checked = True Or chkQQ.Checked = True Or chkPP.Checked = True Then - ' chkCDF.Checked = True - 'End If - 'Else - ' chkDensity.Enabled = True - ' chkQQ.Enabled = True - ' chkPP.Enabled = True - 'End If - 'End Sub - Private Sub chkInputBreakpoints_Checked_Changed(sender As Object, e As EventArgs) Handles chkInputBreakpoints.CheckedChanged DisplayChiBreaks() End Sub @@ -161,7 +144,6 @@ Public Class sdgOneVarCompareModels 'TODO Graph Names assigned go up in increments for any of the graphs selected (e.g. 3 plots are selected and it is named "plots", then automatically we get "plots1", ... , "plots3" 'End Sub - Public Function TestOkEnabled() As Boolean Dim bOkEnabled As Boolean If (chkSaveObjects.Checked AndAlso Not ucrObjectName.IsEmpty OrElse Not chkSaveObjects.Checked) AndAlso (chkSaveChi.Checked AndAlso Not ucrDisplayChiData.IsEmpty OrElse Not chkSaveChi.Checked) Then diff --git a/instat/sdgOneVarFitModDisplay.vb b/instat/sdgOneVarFitModDisplay.vb index c90dc852851..5de11a7859d 100644 --- a/instat/sdgOneVarFitModDisplay.vb +++ b/instat/sdgOneVarFitModDisplay.vb @@ -17,7 +17,6 @@ Imports instat.Translations Public Class sdgOneVarFitModDisplay Private clsRplotFunction As New RFunction - Private clsSaveLikelihood As New RFunction Private clsModel As New RFunction Private clsRLogLikFunction As New RFunction Private WithEvents ucrDists As ucrDistributions diff --git a/instat/sdgOneVarFitModel.vb b/instat/sdgOneVarFitModel.vb index 3c5e1e45f60..29b0eeca1cd 100644 --- a/instat/sdgOneVarFitModel.vb +++ b/instat/sdgOneVarFitModel.vb @@ -31,17 +31,8 @@ Public Class sdgOneVarFitModel clsRSyntax.AddParameter("method") End Sub - Public Sub SetDefaults() - rdoMle.Enabled = True - rdoMme.Enabled = True rdoQme.Enabled = False - rdoMge.Enabled = True - rdoDefault.Enabled = True - rdoNelderMead.Enabled = True - rdoBFGS.Enabled = True - rdoCG.Enabled = True - rdoSANN.Enabled = True rdoDefault.Checked = True rdoMle.Checked = True 'ucrBase.ihelptopicID = @@ -52,7 +43,6 @@ Public Class sdgOneVarFitModel End Sub Private Sub rdoOptimMethod_CheckedChanged(sender As Object, e As EventArgs) Handles rdoDefault.CheckedChanged, rdoNelderMead.CheckedChanged, rdoBFGS.CheckedChanged, rdoCG.CheckedChanged, rdoSANN.CheckedChanged - If rdoDefault.Checked Then clsRSyntax.AddParameter("optim.method", Chr(34) & "default" & Chr(34)) ElseIf rdoNelderMead.Checked Then diff --git a/instat/sdgOneVarUseModFit.Designer.vb b/instat/sdgOneVarUseModFit.Designer.vb index a45f1785443..4948d7a1dcf 100644 --- a/instat/sdgOneVarUseModFit.Designer.vb +++ b/instat/sdgOneVarUseModFit.Designer.vb @@ -32,6 +32,7 @@ Partial Class sdgOneVarUseModFit Me.rdoPlotAll = New System.Windows.Forms.RadioButton() Me.rdoNoPlot = New System.Windows.Forms.RadioButton() Me.TabPage2 = New System.Windows.Forms.TabPage() + Me.ucrInputValues = New instat.ucrMultipleInput() Me.lblBy = New System.Windows.Forms.Label() Me.lblTo = New System.Windows.Forms.Label() Me.lblFrom = New System.Windows.Forms.Label() @@ -56,7 +57,7 @@ Partial Class sdgOneVarUseModFit Me.tbcQuantiles.Location = New System.Drawing.Point(7, 7) Me.tbcQuantiles.Name = "tbcQuantiles" Me.tbcQuantiles.SelectedIndex = 0 - Me.tbcQuantiles.Size = New System.Drawing.Size(218, 210) + Me.tbcQuantiles.Size = New System.Drawing.Size(218, 209) Me.tbcQuantiles.TabIndex = 2 ' 'tbcPlots @@ -71,7 +72,7 @@ Partial Class sdgOneVarUseModFit Me.tbcPlots.Location = New System.Drawing.Point(4, 22) Me.tbcPlots.Name = "tbcPlots" Me.tbcPlots.Padding = New System.Windows.Forms.Padding(3) - Me.tbcPlots.Size = New System.Drawing.Size(210, 184) + Me.tbcPlots.Size = New System.Drawing.Size(210, 191) Me.tbcPlots.TabIndex = 0 Me.tbcPlots.Text = "Plots" Me.tbcPlots.UseVisualStyleBackColor = True @@ -150,6 +151,7 @@ Partial Class sdgOneVarUseModFit ' 'TabPage2 ' + Me.TabPage2.Controls.Add(Me.ucrInputValues) Me.TabPage2.Controls.Add(Me.lblBy) Me.TabPage2.Controls.Add(Me.lblTo) Me.TabPage2.Controls.Add(Me.lblFrom) @@ -161,11 +163,18 @@ Partial Class sdgOneVarUseModFit Me.TabPage2.Location = New System.Drawing.Point(4, 22) Me.TabPage2.Name = "TabPage2" Me.TabPage2.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage2.Size = New System.Drawing.Size(210, 184) + Me.TabPage2.Size = New System.Drawing.Size(210, 183) Me.TabPage2.TabIndex = 1 Me.TabPage2.Text = "Quantiles" Me.TabPage2.UseVisualStyleBackColor = True ' + 'ucrInputValues + ' + Me.ucrInputValues.Location = New System.Drawing.Point(5, 152) + Me.ucrInputValues.Name = "ucrInputValues" + Me.ucrInputValues.Size = New System.Drawing.Size(156, 29) + Me.ucrInputValues.TabIndex = 8 + ' 'lblBy ' Me.lblBy.AutoSize = True @@ -243,7 +252,7 @@ Partial Class sdgOneVarUseModFit ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(11, 223) + Me.ucrBase.Location = New System.Drawing.Point(44, 218) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(142, 30) Me.ucrBase.TabIndex = 3 @@ -252,7 +261,7 @@ Partial Class sdgOneVarUseModFit ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(229, 259) + Me.ClientSize = New System.Drawing.Size(229, 256) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.tbcQuantiles) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow @@ -291,4 +300,5 @@ Partial Class sdgOneVarUseModFit Friend WithEvents nudBy As NumericUpDown Friend WithEvents nudTo As NumericUpDown Friend WithEvents nudFrom As NumericUpDown + Friend WithEvents ucrInputValues As ucrMultipleInput End Class diff --git a/instat/sdgOneVarUseModFit.vb b/instat/sdgOneVarUseModFit.vb index e533844308a..2f692749381 100644 --- a/instat/sdgOneVarUseModFit.vb +++ b/instat/sdgOneVarUseModFit.vb @@ -43,8 +43,6 @@ Public Class sdgOneVarUseModFit rdoPlotAll.Checked = True rdoSeqValues.Checked = True rdoInsertValues.Enabled = False - 'any of InsertValues needs to be disabled here. - 'ucrBase.ihelptopicID = SetPlotOptions() nudFrom.Value = 0 nudTo.Value = 1 @@ -110,8 +108,14 @@ Public Class sdgOneVarUseModFit Else rdoCIcdf.Enabled = True End If + End Sub - ' if discrete discribution then cannot do PP, QQ, dens + Private Sub rdoInsertValues_CheckedChanged(sender As Object, e As EventArgs) Handles rdoInsertValues.CheckedChanged + If rdoInsertValues.Checked Then + ucrInputValues.Enabled = True + Else + ucrInputValues.Enabled = False + End If End Sub End Class \ No newline at end of file From fccda7c10f1eef97dee57feb45f30de4c3ccf2a2 Mon Sep 17 00:00:00 2001 From: Lily Date: Wed, 12 Oct 2016 16:57:23 +0100 Subject: [PATCH 07/13] (Some) One Variable Graph fixes --- instat/dlgOneVariableGraph.vb | 1 + instat/sdgOneVarGraph.Designer.vb | 72 +++++++++++++++---------------- instat/sdgOneVarGraph.vb | 12 ++++++ 3 files changed, 49 insertions(+), 36 deletions(-) diff --git a/instat/dlgOneVariableGraph.vb b/instat/dlgOneVariableGraph.vb index 894b4542b0f..17af3ed9e61 100644 --- a/instat/dlgOneVariableGraph.vb +++ b/instat/dlgOneVariableGraph.vb @@ -148,6 +148,7 @@ Public Class dlgOneVariableGraph Private Sub rdoFacets_CheckedChanged(sender As Object, e As EventArgs) Handles rdoFacets.CheckedChanged, rdoCombineGraph.CheckedChanged, rdoSingleGraphs.CheckedChanged SetOutputparameter() + sdgOneVarGraph.EnableFreeScaleAxisforFacets() End Sub Private Sub SetOutputparameter() diff --git a/instat/sdgOneVarGraph.Designer.vb b/instat/sdgOneVarGraph.Designer.vb index 0138a9184ca..dc7e6e5644c 100644 --- a/instat/sdgOneVarGraph.Designer.vb +++ b/instat/sdgOneVarGraph.Designer.vb @@ -26,14 +26,14 @@ Partial Class sdgOneVarGraph Me.tbpTypes = New System.Windows.Forms.TabPage() Me.lblCategorical = New System.Windows.Forms.Label() Me.lblNumeric = New System.Windows.Forms.Label() - Me.ucrInputCategorical = New instat.ucrInputComboBox() - Me.ucrInputNumeric = New instat.ucrInputComboBox() Me.tbpDisplay = New System.Windows.Forms.TabPage() Me.chkFreeScaleAxisforFacets = New System.Windows.Forms.CheckBox() Me.lblNumberofColumns = New System.Windows.Forms.Label() Me.nudNumberofColumns = New System.Windows.Forms.NumericUpDown() Me.chkSpecifyLayout = New System.Windows.Forms.CheckBox() Me.ucrButtonsOneVarGraph = New instat.ucrButtonsSubdialogue() + Me.ucrInputCategorical = New instat.ucrInputComboBox() + Me.ucrInputNumeric = New instat.ucrInputComboBox() Me.tbcOneVarGraph.SuspendLayout() Me.tbpTypes.SuspendLayout() Me.tbpDisplay.SuspendLayout() @@ -45,11 +45,11 @@ Partial Class sdgOneVarGraph Me.tbcOneVarGraph.AccessibleName = "" Me.tbcOneVarGraph.Controls.Add(Me.tbpTypes) Me.tbcOneVarGraph.Controls.Add(Me.tbpDisplay) - Me.tbcOneVarGraph.Location = New System.Drawing.Point(1, 1) + Me.tbcOneVarGraph.Location = New System.Drawing.Point(5, 7) Me.tbcOneVarGraph.Margin = New System.Windows.Forms.Padding(0) Me.tbcOneVarGraph.Name = "tbcOneVarGraph" Me.tbcOneVarGraph.SelectedIndex = 0 - Me.tbcOneVarGraph.Size = New System.Drawing.Size(276, 172) + Me.tbcOneVarGraph.Size = New System.Drawing.Size(245, 168) Me.tbcOneVarGraph.TabIndex = 0 ' 'tbpTypes @@ -61,7 +61,7 @@ Partial Class sdgOneVarGraph Me.tbpTypes.Location = New System.Drawing.Point(4, 22) Me.tbpTypes.Name = "tbpTypes" Me.tbpTypes.Padding = New System.Windows.Forms.Padding(3) - Me.tbpTypes.Size = New System.Drawing.Size(268, 146) + Me.tbpTypes.Size = New System.Drawing.Size(237, 142) Me.tbpTypes.TabIndex = 0 Me.tbpTypes.Text = "Types" Me.tbpTypes.UseVisualStyleBackColor = True @@ -69,36 +69,20 @@ Partial Class sdgOneVarGraph 'lblCategorical ' Me.lblCategorical.AutoSize = True - Me.lblCategorical.Location = New System.Drawing.Point(10, 50) + Me.lblCategorical.Location = New System.Drawing.Point(10, 53) Me.lblCategorical.Name = "lblCategorical" - Me.lblCategorical.Size = New System.Drawing.Size(60, 13) + Me.lblCategorical.Size = New System.Drawing.Size(63, 13) Me.lblCategorical.TabIndex = 4 - Me.lblCategorical.Text = "Categorical" + Me.lblCategorical.Text = "Categorical:" ' 'lblNumeric ' Me.lblNumeric.AutoSize = True - Me.lblNumeric.Location = New System.Drawing.Point(10, 8) + Me.lblNumeric.Location = New System.Drawing.Point(10, 22) Me.lblNumeric.Name = "lblNumeric" - Me.lblNumeric.Size = New System.Drawing.Size(46, 13) + Me.lblNumeric.Size = New System.Drawing.Size(49, 13) Me.lblNumeric.TabIndex = 4 - Me.lblNumeric.Text = "Numeric" - ' - 'ucrInputCategorical - ' - Me.ucrInputCategorical.IsReadOnly = False - Me.ucrInputCategorical.Location = New System.Drawing.Point(76, 50) - Me.ucrInputCategorical.Name = "ucrInputCategorical" - Me.ucrInputCategorical.Size = New System.Drawing.Size(137, 21) - Me.ucrInputCategorical.TabIndex = 3 - ' - 'ucrInputNumeric - ' - Me.ucrInputNumeric.IsReadOnly = False - Me.ucrInputNumeric.Location = New System.Drawing.Point(76, 6) - Me.ucrInputNumeric.Name = "ucrInputNumeric" - Me.ucrInputNumeric.Size = New System.Drawing.Size(137, 21) - Me.ucrInputNumeric.TabIndex = 3 + Me.lblNumeric.Text = "Numeric:" ' 'tbpDisplay ' @@ -109,7 +93,7 @@ Partial Class sdgOneVarGraph Me.tbpDisplay.Location = New System.Drawing.Point(4, 22) Me.tbpDisplay.Name = "tbpDisplay" Me.tbpDisplay.Padding = New System.Windows.Forms.Padding(3) - Me.tbpDisplay.Size = New System.Drawing.Size(268, 146) + Me.tbpDisplay.Size = New System.Drawing.Size(237, 117) Me.tbpDisplay.TabIndex = 1 Me.tbpDisplay.Text = "Display" Me.tbpDisplay.UseVisualStyleBackColor = True @@ -117,7 +101,7 @@ Partial Class sdgOneVarGraph 'chkFreeScaleAxisforFacets ' Me.chkFreeScaleAxisforFacets.AutoSize = True - Me.chkFreeScaleAxisforFacets.Location = New System.Drawing.Point(10, 69) + Me.chkFreeScaleAxisforFacets.Location = New System.Drawing.Point(11, 85) Me.chkFreeScaleAxisforFacets.Name = "chkFreeScaleAxisforFacets" Me.chkFreeScaleAxisforFacets.Size = New System.Drawing.Size(149, 17) Me.chkFreeScaleAxisforFacets.TabIndex = 5 @@ -127,15 +111,15 @@ Partial Class sdgOneVarGraph 'lblNumberofColumns ' Me.lblNumberofColumns.AutoSize = True - Me.lblNumberofColumns.Location = New System.Drawing.Point(7, 37) + Me.lblNumberofColumns.Location = New System.Drawing.Point(8, 49) Me.lblNumberofColumns.Name = "lblNumberofColumns" - Me.lblNumberofColumns.Size = New System.Drawing.Size(99, 13) + Me.lblNumberofColumns.Size = New System.Drawing.Size(102, 13) Me.lblNumberofColumns.TabIndex = 4 - Me.lblNumberofColumns.Text = "Number of Columns" + Me.lblNumberofColumns.Text = "Number of Columns:" ' 'nudNumberofColumns ' - Me.nudNumberofColumns.Location = New System.Drawing.Point(127, 35) + Me.nudNumberofColumns.Location = New System.Drawing.Point(116, 46) Me.nudNumberofColumns.Name = "nudNumberofColumns" Me.nudNumberofColumns.Size = New System.Drawing.Size(43, 20) Me.nudNumberofColumns.TabIndex = 3 @@ -143,7 +127,7 @@ Partial Class sdgOneVarGraph 'chkSpecifyLayout ' Me.chkSpecifyLayout.AutoSize = True - Me.chkSpecifyLayout.Location = New System.Drawing.Point(7, 6) + Me.chkSpecifyLayout.Location = New System.Drawing.Point(10, 22) Me.chkSpecifyLayout.Name = "chkSpecifyLayout" Me.chkSpecifyLayout.Size = New System.Drawing.Size(96, 17) Me.chkSpecifyLayout.TabIndex = 2 @@ -152,16 +136,32 @@ Partial Class sdgOneVarGraph ' 'ucrButtonsOneVarGraph ' - Me.ucrButtonsOneVarGraph.Location = New System.Drawing.Point(63, 178) + Me.ucrButtonsOneVarGraph.Location = New System.Drawing.Point(9, 177) Me.ucrButtonsOneVarGraph.Name = "ucrButtonsOneVarGraph" Me.ucrButtonsOneVarGraph.Size = New System.Drawing.Size(145, 30) Me.ucrButtonsOneVarGraph.TabIndex = 1 ' + 'ucrInputCategorical + ' + Me.ucrInputCategorical.IsReadOnly = False + Me.ucrInputCategorical.Location = New System.Drawing.Point(76, 50) + Me.ucrInputCategorical.Name = "ucrInputCategorical" + Me.ucrInputCategorical.Size = New System.Drawing.Size(137, 21) + Me.ucrInputCategorical.TabIndex = 3 + ' + 'ucrInputNumeric + ' + Me.ucrInputNumeric.IsReadOnly = False + Me.ucrInputNumeric.Location = New System.Drawing.Point(76, 19) + Me.ucrInputNumeric.Name = "ucrInputNumeric" + Me.ucrInputNumeric.Size = New System.Drawing.Size(137, 21) + Me.ucrInputNumeric.TabIndex = 3 + ' 'sdgOneVarGraph ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(289, 216) + Me.ClientSize = New System.Drawing.Size(253, 216) Me.Controls.Add(Me.ucrButtonsOneVarGraph) Me.Controls.Add(Me.tbcOneVarGraph) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow diff --git a/instat/sdgOneVarGraph.vb b/instat/sdgOneVarGraph.vb index cf4a20ad9bc..976b66900dc 100644 --- a/instat/sdgOneVarGraph.vb +++ b/instat/sdgOneVarGraph.vb @@ -102,12 +102,24 @@ Public Class sdgOneVarGraph dlgOneVariableGraph.OneOrMoreVariables() End Sub + Public Sub EnableFreeScaleAxisforFacets() + If Not dlgOneVariableGraph.rdoFacets.Checked Then + chkFreeScaleAxisforFacets.Enabled = False + If chkFreeScaleAxisforFacets.Checked Then + chkFreeScaleAxisforFacets.Checked = False + End If + Else + chkFreeScaleAxisforFacets.Enabled = True + End If + End Sub + Private Sub chkFreeScaleAxisforFacets_CheckedChanged(sender As Object, e As EventArgs) Handles chkFreeScaleAxisforFacets.CheckedChanged If chkFreeScaleAxisforFacets.Checked Then clsRsyntax.AddParameter("free_scale_axis", "TRUE") Else clsRsyntax.RemoveParameter("free_scale_axis") End If + EnableFreeScaleAxisforFacets() End Sub Private Sub nudNumberofColumns_TextChanged(sender As Object, e As EventArgs) Handles nudNumberofColumns.TextChanged, chkSpecifyLayout.CheckedChanged From f82228d4e270c692d1536f3cf6823f743b22a32c Mon Sep 17 00:00:00 2001 From: dannyparsons Date: Wed, 12 Oct 2016 18:32:30 +0100 Subject: [PATCH 08/13] initial create factor data frame method in R --- .../static/InstatObject/R/instat_object_R6.R | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index 680e9104832..13236d7d2cf 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -952,4 +952,45 @@ instat_object$set("public","make_date_yeardoy", function(data_name, year, doy, y instat_object$set("public","set_contrasts_of_factor", function(data_name, factor, new_contrasts) { self$get_data_objects(data_name)$set_contrasts_of_factor(factor = factor, new_contrasts = new_contrasts) } +) + +instat_object$set("public","create_factor_data_frame", function(data_name, factor, factor_data_frame_name, include_contrasts = TRUE, replace = FALSE) { + curr_data_obj <- self$get_data_objects(data_name) + if(!factor %in% names(curr_data_obj$get_data_frame())) stop(factor, " not found in the data") + if(!is.factor(curr_data_obj$get_columns_from_data(factor))) stop(factor, " is not a factor column.") + create <- TRUE + if(self$link_exists_from(data_name, factor)) { + message("Factor data frame already exists.") + if(replace) { + message("Current factor data frame will be replaced.") + #TODO replacing not implemented yet + # This line should be removed when implemented + create <- FALSE + } + else create <- FALSE + } + if(create) { + data_frame_list <- list() + if(missing(factor_data_frame_name)) factor_data_frame_name <- paste0(data_name, "_", factor) + factor_data_frame_name <- make.names(factor_data_frame_name) + factor_data_frame_name <- next_default_item(factor_data_frame_name, self$get_data_names(), include_index = FALSE) + + factor_column <- curr_data_obj$get_columns_from_data(factor) + factor_data_frame <- data.frame(levels(factor_column)) + names(factor_data_frame) <- factor + if(include_contrasts) { + factor_data_frame <- cbind(factor_data_frame, contrasts(factor_column)) + } + row.names(factor_data_frame) <- 1:nrow(factor_data_frame) + names(factor_data_frame)[2:ncol(factor_data_frame)] <- paste0("C", 1:(ncol(factor_data_frame)-1)) + data_frame_list[[factor_data_frame_name]] <- factor_data_frame + self$import_data(data_frame_list) + factor_data_obj <- self$get_data_objects(factor_data_frame_name) + factor_data_obj$add_key(factor) + link_calc <- calculation$new(type = "summary", parameters = factor) + link_obj <- link$new(from_data_frame = data_name, type = keyed_link_label, calculation = link_calc) + link_obj$to_data_frame <- factor_data_frame_name + self$add_link(link_obj) + } +} ) \ No newline at end of file From fa7fef9663921eff87c7cecaa7668000caa1940f Mon Sep 17 00:00:00 2001 From: dannyparsons Date: Wed, 12 Oct 2016 18:42:55 +0100 Subject: [PATCH 09/13] add link check function --- .../InstatObject/R/Backend_Components/link.R | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/instat/static/InstatObject/R/Backend_Components/link.R b/instat/static/InstatObject/R/Backend_Components/link.R index e8a49ba2670..ca2c2bd6e90 100644 --- a/instat/static/InstatObject/R/Backend_Components/link.R +++ b/instat/static/InstatObject/R/Backend_Components/link.R @@ -71,4 +71,19 @@ instat_object$set("public", "add_link", function(link_object) { instat_object$set("public", "link_exists", function(new_link) { return(any(sapply(private$.links, function(link) link$equals(new_link)))) } +) + +instat_object$set("public", "link_exists_from", function(from_data_frame, factors) { + link_calc <- calculation$new(type = "summary", parameters = factors) + link_obj <- link$new(from_data_frame = from_data_frame, type = keyed_link_label, calculation = link_calc) + exists = FALSE + for(data_obj in self$get_data_objects()) { + link_obj$to_data_frame <- data_obj$get_metadata(data_name_label) + if(self$link_exists(link_obj)) { + exists = TRUE + break + } + } + return(exists) +} ) \ No newline at end of file From e09727e2293ef83414327f566e7e1ad9cd92fee3 Mon Sep 17 00:00:00 2001 From: dannyparsons Date: Wed, 12 Oct 2016 18:56:22 +0100 Subject: [PATCH 10/13] updated link functions --- instat/static/InstatObject/R/Backend_Components/link.R | 6 ++---- .../InstatObject/R/Backend_Components/summary_functions.R | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/instat/static/InstatObject/R/Backend_Components/link.R b/instat/static/InstatObject/R/Backend_Components/link.R index ca2c2bd6e90..ee9347f77d4 100644 --- a/instat/static/InstatObject/R/Backend_Components/link.R +++ b/instat/static/InstatObject/R/Backend_Components/link.R @@ -29,11 +29,9 @@ link$set("public", "equals", function(compare_link) { && self$to_data_frame == compare_link$to_data_frame && self$type == compare_link$type) { if(self$type == keyed_link_label) { - #print(self$calculation$parameters) - #print(compare_link$calculation$parameters) if(setequal(self$calculation$parameters, compare_link$calculation$parameters) && setequal(names(self$calculation$parameters), names(compare_link$calculation$parameters))) { - for(name in names(compare_link$calculation$parameters)) { - if(compare_link$calculation$parameters[[name]] != self$calculation$parameters[[name]]) return(FALSE) + for(factor_col in compare_link$calculation$parameters) { + if(!factor_col %in% self$calculation$parameters) return(FALSE) } return(TRUE) } diff --git a/instat/static/InstatObject/R/Backend_Components/summary_functions.R b/instat/static/InstatObject/R/Backend_Components/summary_functions.R index efd16289397..cbd715dbe36 100644 --- a/instat/static/InstatObject/R/Backend_Components/summary_functions.R +++ b/instat/static/InstatObject/R/Backend_Components/summary_functions.R @@ -33,7 +33,6 @@ data_object$set("public", "merge_data", function(new_data, by = NULL, type = "le instat_object$set("public", "append_summaries_to_data_object", function(out, data_name, columns_to_summarise, summaries, factors = c(), summary_name, calc, calc_name = "") { if(!is.character(data_name)) stop("data_name must be of type character") factors_list <- factors - names(factors_list) <- factors link_calc <- calculation$new(type = "summary", parameters = factors_list) link_obj <- link$new(from_data_frame = data_name, type = keyed_link_label, calculation = link_calc) exists = FALSE From 04c326f9ba20034436e0b087442b517227fcd5cd Mon Sep 17 00:00:00 2001 From: lilyclements Date: Thu, 13 Oct 2016 09:56:44 +0100 Subject: [PATCH 11/13] Update dlgOneVariableGraph.vb --- instat/dlgOneVariableGraph.vb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/instat/dlgOneVariableGraph.vb b/instat/dlgOneVariableGraph.vb index 17af3ed9e61..ae0f781ff63 100644 --- a/instat/dlgOneVariableGraph.vb +++ b/instat/dlgOneVariableGraph.vb @@ -148,7 +148,6 @@ Public Class dlgOneVariableGraph Private Sub rdoFacets_CheckedChanged(sender As Object, e As EventArgs) Handles rdoFacets.CheckedChanged, rdoCombineGraph.CheckedChanged, rdoSingleGraphs.CheckedChanged SetOutputparameter() - sdgOneVarGraph.EnableFreeScaleAxisforFacets() End Sub Private Sub SetOutputparameter() @@ -176,4 +175,4 @@ Public Class dlgOneVariableGraph rdoCombineGraph.Enabled = False End If End Sub -End Class \ No newline at end of file +End Class From d70938e8221235ac521c706f0493ec6a82cbe679 Mon Sep 17 00:00:00 2001 From: lilyclements Date: Thu, 13 Oct 2016 09:59:19 +0100 Subject: [PATCH 12/13] Update sdgOneVarGraph.vb --- instat/sdgOneVarGraph.vb | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/instat/sdgOneVarGraph.vb b/instat/sdgOneVarGraph.vb index 976b66900dc..1f39b027bdb 100644 --- a/instat/sdgOneVarGraph.vb +++ b/instat/sdgOneVarGraph.vb @@ -101,25 +101,13 @@ Public Class sdgOneVarGraph SetCategoricalGeomFunction() dlgOneVariableGraph.OneOrMoreVariables() End Sub - - Public Sub EnableFreeScaleAxisforFacets() - If Not dlgOneVariableGraph.rdoFacets.Checked Then - chkFreeScaleAxisforFacets.Enabled = False - If chkFreeScaleAxisforFacets.Checked Then - chkFreeScaleAxisforFacets.Checked = False - End If - Else - chkFreeScaleAxisforFacets.Enabled = True - End If - End Sub - + Private Sub chkFreeScaleAxisforFacets_CheckedChanged(sender As Object, e As EventArgs) Handles chkFreeScaleAxisforFacets.CheckedChanged If chkFreeScaleAxisforFacets.Checked Then clsRsyntax.AddParameter("free_scale_axis", "TRUE") Else clsRsyntax.RemoveParameter("free_scale_axis") End If - EnableFreeScaleAxisforFacets() End Sub Private Sub nudNumberofColumns_TextChanged(sender As Object, e As EventArgs) Handles nudNumberofColumns.TextChanged, chkSpecifyLayout.CheckedChanged @@ -130,4 +118,4 @@ Public Class sdgOneVarGraph clsRsyntax.RemoveParameter("ncol") End If End Sub -End Class \ No newline at end of file +End Class From b0fc42098446d5fef375552a372b114a7ee73107 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Thu, 13 Oct 2016 14:32:20 +0300 Subject: [PATCH 13/13] SubDlg on factor data frame --- instat/instat.vbproj | 9 ++ instat/sdgFactorDataFrame.Designer.vb | 48 +++++++++++ instat/sdgFactorDataFrame.resx | 120 ++++++++++++++++++++++++++ instat/sdgFactorDataFrame.vb | 3 + 4 files changed, 180 insertions(+) create mode 100644 instat/sdgFactorDataFrame.Designer.vb create mode 100644 instat/sdgFactorDataFrame.resx create mode 100644 instat/sdgFactorDataFrame.vb diff --git a/instat/instat.vbproj b/instat/instat.vbproj index dd7af6af28e..1d955673934 100644 --- a/instat/instat.vbproj +++ b/instat/instat.vbproj @@ -254,6 +254,12 @@ Form + + sdgFactorDataFrame.vb + + + Form + sdgMerge.vb @@ -2763,6 +2769,9 @@ sdgDescribeTwoVarGraph.vb + + sdgFactorDataFrame.vb + sdgMerge.vb diff --git a/instat/sdgFactorDataFrame.Designer.vb b/instat/sdgFactorDataFrame.Designer.vb new file mode 100644 index 00000000000..254067bbe9b --- /dev/null +++ b/instat/sdgFactorDataFrame.Designer.vb @@ -0,0 +1,48 @@ + _ +Partial Class sdgFactorDataFrame + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.ucrBaseFactorSubdlg = New instat.ucrButtonsSubdialogue() + Me.SuspendLayout() + ' + 'ucrBaseFactorSubdlg + ' + Me.ucrBaseFactorSubdlg.Location = New System.Drawing.Point(12, 219) + Me.ucrBaseFactorSubdlg.Name = "ucrBaseFactorSubdlg" + Me.ucrBaseFactorSubdlg.Size = New System.Drawing.Size(142, 30) + Me.ucrBaseFactorSubdlg.TabIndex = 0 + ' + 'sdgFactorDataFrame + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(284, 261) + Me.Controls.Add(Me.ucrBaseFactorSubdlg) + Me.Name = "sdgFactorDataFrame" + Me.Text = "sdgFactorDataFrame" + Me.ResumeLayout(False) + + End Sub + + Friend WithEvents ucrBaseFactorSubdlg As ucrButtonsSubdialogue +End Class diff --git a/instat/sdgFactorDataFrame.resx b/instat/sdgFactorDataFrame.resx new file mode 100644 index 00000000000..29dcb1b3a35 --- /dev/null +++ b/instat/sdgFactorDataFrame.resx @@ -0,0 +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 + + \ No newline at end of file diff --git a/instat/sdgFactorDataFrame.vb b/instat/sdgFactorDataFrame.vb new file mode 100644 index 00000000000..2c7564a78a5 --- /dev/null +++ b/instat/sdgFactorDataFrame.vb @@ -0,0 +1,3 @@ +Public Class sdgFactorDataFrame + +End Class \ No newline at end of file