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/dlgCalculator.designer.vb b/instat/dlgCalculator.designer.vb index 7f1cb7ec141..100fd54170f 100644 --- a/instat/dlgCalculator.designer.vb +++ b/instat/dlgCalculator.designer.vb @@ -144,6 +144,7 @@ Partial Class dlgCalculator Me.cmdLfact = New System.Windows.Forms.Button() Me.cmdTrigamma = New System.Windows.Forms.Button() Me.cmdBeta = New System.Windows.Forms.Button() + Me.cmdHelp = New System.Windows.Forms.Button() Me.ucrInputCalOptions = New instat.ucrInputComboBox() Me.ucrReceiverForCalculation = New instat.ucrReceiverExpression() Me.ucrSaveResultInto = New instat.ucrInputComboBox() @@ -1547,6 +1548,15 @@ Partial Class dlgCalculator Me.cmdBeta.Text = "beta" Me.cmdBeta.UseVisualStyleBackColor = True ' + 'cmdHelp + ' + Me.cmdHelp.Location = New System.Drawing.Point(427, 223) + Me.cmdHelp.Name = "cmdHelp" + Me.cmdHelp.Size = New System.Drawing.Size(75, 23) + Me.cmdHelp.TabIndex = 172 + Me.cmdHelp.Text = "Help" + Me.cmdHelp.UseVisualStyleBackColor = True + ' 'ucrInputCalOptions ' Me.ucrInputCalOptions.IsReadOnly = False @@ -1605,7 +1615,8 @@ Partial Class dlgCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(832, 340) + Me.ClientSize = New System.Drawing.Size(417, 340) + Me.Controls.Add(Me.cmdHelp) Me.Controls.Add(Me.grpDates) Me.Controls.Add(Me.grpProbabilty) Me.Controls.Add(Me.chkShowArguments) @@ -1770,4 +1781,5 @@ Partial Class dlgCalculator Friend WithEvents cmdClossingBracket As Button Friend WithEvents cmdQuotes As Button Friend WithEvents cmdSquareBrackets As Button + Friend WithEvents cmdHelp As Button End Class diff --git a/instat/dlgCalculator.vb b/instat/dlgCalculator.vb index 474fb27a4b9..d7eacc5356e 100644 --- a/instat/dlgCalculator.vb +++ b/instat/dlgCalculator.vb @@ -22,15 +22,16 @@ Public Class dlgCalculator Dim clsAttach As New RFunction Dim clsDetach As New RFunction Public bFirstLoad As Boolean = True + Public iHelpCalcID As Integer + Private Sub dlgCalculator_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) - ucrBase.iHelpTopicID = 14 If bFirstLoad Then InitialiseDialog() SetDefaults() bFirstLoad = False - Else + Else ReopenDialog() End If TestOKEnabled() @@ -69,6 +70,7 @@ Public Class dlgCalculator End Sub Private Sub InitialiseDialog() + ucrBase.iHelpTopicID = 14 ucrReceiverForCalculation.Selector = ucrSelectorForCalculations ucrReceiverForCalculation.SetMeAsReceiver() clsAttach.SetRCommand("attach") @@ -81,8 +83,9 @@ Public Class dlgCalculator ucrSaveResultInto.SetDefaultTypeAsColumn() ucrSaveResultInto.SetDataFrameSelector(ucrSelectorForCalculations.ucrAvailableDataFrames) ucrSelectorForCalculations.Reset() - ucrInputCalOptions.SetItems({"Basic", "Maths", "Logical and Symbols", "Statistics", "Strings", "Probability", "Dates"}) + ucrInputCalOptions.SetItems({"Basic", "Maths", "Logical and Symbols", "Summary", "Text", "Runoff", "Dates"}) ucrSaveResultInto.SetValidationTypeAsRVariable() + End Sub Private Sub cmd0_Click(sender As Object, e As EventArgs) Handles cmd0.Click @@ -212,6 +215,10 @@ Public Class dlgCalculator End Sub Private Sub ucrInputCalOptions_NameChanged() Handles ucrInputCalOptions.NameChanged + CalculationsOptions() + End Sub + + Private Sub CalculationsOptions() Select Case ucrInputCalOptions.GetText Case "Maths" grpStatistics.Visible = False @@ -220,6 +227,7 @@ Public Class dlgCalculator grpBasic.Visible = True grpStrings.Visible = False grpProbabilty.Visible = False + iHelpCalcID = 126 Me.Size = New System.Drawing.Size(614, 377) Case "Logical and Symbols" grpDates.Visible = False @@ -230,7 +238,10 @@ Public Class dlgCalculator grpStrings.Visible = False Me.Size = New System.Drawing.Size(580, 377) grpProbabilty.Visible = False - Case "Statistics" + iHelpCalcID = 127 + + + Case "Summary" grpDates.Visible = False grpStatistics.Visible = True grpLogical.Visible = False @@ -239,7 +250,8 @@ Public Class dlgCalculator Me.Size = New System.Drawing.Size(552, 377) grpStrings.Visible = False grpProbabilty.Visible = False - Case "Strings" + iHelpCalcID = 128 + Case "Text" grpDates.Visible = False grpStrings.Visible = True grpStatistics.Visible = False @@ -248,7 +260,8 @@ Public Class dlgCalculator grpBasic.Visible = True grpProbabilty.Visible = False Me.Size = New System.Drawing.Size(580, 377) - Case "Probability" + iHelpCalcID = 338 + Case "Runoff" grpDates.Visible = False grpProbabilty.Visible = True grpStrings.Visible = False @@ -257,6 +270,7 @@ Public Class dlgCalculator grpMaths.Visible = False grpBasic.Visible = True Me.Size = New System.Drawing.Size(749, 377) + iHelpCalcID = 120 Case "Dates" grpDates.Visible = True grpProbabilty.Visible = False @@ -266,6 +280,7 @@ Public Class dlgCalculator grpMaths.Visible = False grpBasic.Visible = True Me.Size = New System.Drawing.Size(589, 377) + iHelpCalcID = 130 Case Else grpDates.Visible = False Me.Size = New System.Drawing.Size(424, 377) @@ -957,4 +972,16 @@ Public Class dlgCalculator Private Sub cmdTry_Click(sender As Object, e As EventArgs) Handles cmdTry.Click TryScript() End Sub + + Private Sub cmdHelp_Click(sender As Object, e As EventArgs) Handles cmdHelp.Click + HelpContent() + End Sub + + Private Sub HelpContent() + If iHelpCalcID > 0 Then + Help.ShowHelp(Me.Parent, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TopicId, iHelpCalcID.ToString()) + Else + Help.ShowHelp(Me.Parent, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TableOfContents) + End If + End Sub End Class \ No newline at end of file diff --git a/instat/dlgCorrelation.vb b/instat/dlgCorrelation.vb index e78eef7f56b..10a2c4f7bc7 100644 --- a/instat/dlgCorrelation.vb +++ b/instat/dlgCorrelation.vb @@ -36,6 +36,9 @@ Public Class dlgCorrelation ucrReceiverMultipleColumns.Selector = ucrSelectorDataFrameVarAddRemove ucrReceiverFirstColumn.SetDataType("numeric") ucrReceiverSecondColumn.SetDataType("numeric") + ucrSelectorDataFrameVarAddRemove.Reset() + ucrSelectorDataFrameVarAddRemove.Focus() + ucrReceiverMultipleColumns.SetSingleTypeStatus(True) ucrReceiverMultipleColumns.SetDataType("numeric") ucrBase.iHelpTopicID = 186 End Sub @@ -45,11 +48,10 @@ Public Class dlgCorrelation End Sub Private Sub SetDefaults() - ucrSelectorDataFrameVarAddRemove.Reset() - ucrSelectorDataFrameVarAddRemove.Focus() rdoPearson.Checked = True rdoMultipleColumns.Checked = True sdgCorrPlot.SetDefaults() + ucrReceiverMultipleColumns.SetMeAsReceiver() TestOKEnabled() End Sub diff --git a/instat/dlgDescribeTwoVarGraph.Designer.vb b/instat/dlgDescribeTwoVarGraph.Designer.vb index 72ec3f7ad5f..48748d8e1aa 100644 --- a/instat/dlgDescribeTwoVarGraph.Designer.vb +++ b/instat/dlgDescribeTwoVarGraph.Designer.vb @@ -24,12 +24,12 @@ Partial Class dlgDescribeTwoVarGraph Private Sub InitializeComponent() Me.cmdOptions = New System.Windows.Forms.Button() Me.lblSecondVariable = New System.Windows.Forms.Label() + Me.lblFirstVariables = New System.Windows.Forms.Label() Me.ucrReceiverMultipleTwoVar = New instat.ucrVariablesAsFactor() Me.ucrSecondVariableReceiver = New instat.ucrReceiverSingle() Me.ucrTwoVarGraphSave = New instat.ucrSaveGraph() Me.ucrSelectorTwoVarGraph = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.lblFirstVariables = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'cmdOptions @@ -38,8 +38,8 @@ Partial Class dlgDescribeTwoVarGraph Me.cmdOptions.Name = "cmdOptions" Me.cmdOptions.Size = New System.Drawing.Size(101, 23) Me.cmdOptions.TabIndex = 11 - Me.cmdOptions.Tag = "Options" - Me.cmdOptions.Text = "Options ..." + Me.cmdOptions.Tag = "Options..." + Me.cmdOptions.Text = "Options..." Me.cmdOptions.UseVisualStyleBackColor = True ' 'lblSecondVariable @@ -51,6 +51,16 @@ Partial Class dlgDescribeTwoVarGraph Me.lblSecondVariable.TabIndex = 14 Me.lblSecondVariable.Text = "Second Variable:" ' + 'lblFirstVariables + ' + Me.lblFirstVariables.AutoSize = True + Me.lblFirstVariables.Location = New System.Drawing.Point(307, 19) + Me.lblFirstVariables.Name = "lblFirstVariables" + Me.lblFirstVariables.Size = New System.Drawing.Size(81, 13) + Me.lblFirstVariables.TabIndex = 16 + Me.lblFirstVariables.Tag = "First_Variable(s)" + Me.lblFirstVariables.Text = "First Variable(s):" + ' 'ucrReceiverMultipleTwoVar ' Me.ucrReceiverMultipleTwoVar.Location = New System.Drawing.Point(284, 12) @@ -92,16 +102,6 @@ Partial Class dlgDescribeTwoVarGraph Me.ucrBase.Size = New System.Drawing.Size(410, 52) Me.ucrBase.TabIndex = 0 ' - 'lblFirstVariables - ' - Me.lblFirstVariables.AutoSize = True - Me.lblFirstVariables.Location = New System.Drawing.Point(307, 19) - Me.lblFirstVariables.Name = "lblFirstVariables" - Me.lblFirstVariables.Size = New System.Drawing.Size(81, 13) - Me.lblFirstVariables.TabIndex = 16 - Me.lblFirstVariables.Tag = "First_Variable(s)" - Me.lblFirstVariables.Text = "First Variable(s):" - ' 'dlgDescribeTwoVarGraph ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index 0f5c66b5b38..0ed627ccd9e 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -16,13 +16,10 @@ Imports instat.Translations Imports RDotNet Public Class dlgDescribeTwoVarGraph - Public strSecondVarType As String - Public strVarType As String - Private clsRGGplotFunction As New RFunction - Private clsRBoxPlotGeom, clsRBoxPlotFacet, clsRScatterPlotGeom, clsRLinePlotGeom, clsRBarDotPlotFacet As New RFunction - Private clsRBoxAesFunction, clsRScatterAesFunction, clsRDotPlotGeom, clsRBarPlotGeom, clsRBarDotAesFunction As New RFunction - Public clsRSummaryAesFunction, clsRStatSummary, clsRSummaryPlotFacet As New RFunction - Dim clsRGGBoxPlot, clsRGGBarDotPlot, clsRGGSummaryPlot As New ROperator + Public strSecondVarType, strVarType As String + Private clsRGGplotFunction, clsRBoxPlotGeom, clsRScatterPlotGeom, clsRLinePlotGeom, clsRSummaryAesFunction, clsRStatSummary, clsRFacet As New RFunction + Private clsRBoxAesFunction, clsRBoxAesFunction2, clsRScatterAesFunction, clsRScatterAesFunction2, clsRDotPlotGeom, clsRBarPlotGeom, clsRBarAesFunction, clsRDotAesFunction, clsRDotAesFunction2 As New RFunction + Private clsRFrequencyPolygonGeom, clsRHistogramGeom, clsRDensityPlotGeom, clsRFreqPolyAesFunction, clsRFreqPolyAesFunction2, clsRHistAesFunction, clsRHistAesFunction2, clsRDensityAesFunction, clsRDensityAesFunction2 As New RFunction Private bFirstLoad As Boolean = True Private Sub dlgDescribeTwoVarGraph_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -34,8 +31,6 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub SetDefaults() - clsRBoxAesFunction.ClearParameters() - clsRScatterAesFunction.ClearParameters() ucrTwoVarGraphSave.Reset() ucrSelectorTwoVarGraph.Reset() ucrSelectorTwoVarGraph.Focus() @@ -43,9 +38,14 @@ Public Class dlgDescribeTwoVarGraph TestOkEnabled() End Sub + Private Sub ucrTwoVarGraphSave_Load(sender As Object, e As EventArgs) + + End Sub + Private Sub InitialiseDialog() ucrBase.clsRsyntax.SetOperation("+") clsRGGplotFunction.SetRCommand("ggplot") + ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRGGplotFunction) ucrReceiverMultipleTwoVar.SetSelector(ucrSelectorTwoVarGraph) ucrReceiverMultipleTwoVar.SetSingleTypeStatus(True) ucrReceiverMultipleTwoVar.SetMultipleOnlyStatus(True) @@ -54,6 +54,9 @@ Public Class dlgDescribeTwoVarGraph ucrTwoVarGraphSave.strPrefix = "TwoVariableGraph" ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrBase.clsRsyntax.iCallType = 0 + clsRFacet.SetRCommand("facet_wrap") + clsRFacet.AddParameter("facets", "~variable") + ucrBase.clsRsyntax.AddOperatorParameter("facet_wrap", clsRFunc:=clsRFacet) ucrBase.iHelpTopicID = 416 End Sub @@ -94,34 +97,90 @@ Public Class dlgDescribeTwoVarGraph strSecondVarType = ucrSecondVariableReceiver.strCurrDataType If ((strVarType = "numeric" OrElse strVarType = "integer") And (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then ScatterLinePlot() - If sdgDescribeTwoVarGraph.rdoScatterPlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRGGplotFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) - ElseIf sdgDescribeTwoVarGraph.rdoLinePlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRGGplotFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) - End If - ElseIf ((strVarType = "numeric" OrElse strVarType = "integer") And (strSecondVarType = "factor")) Then - BoxPlot() - If sdgDescribeTwoVarGraph.rdoBoxPlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBoxPlot) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBoxPlotFacet) - End If - ElseIf ((strVarType = "factor") And (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then - SummaryPlot() - If sdgDescribeTwoVarGraph.rdoSummaryPlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGSummaryPlot) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRSummaryPlotFacet) - End If - ElseIf ((strVarType = "factor") And (strSecondVarType = "factor")) Then - BarDotPlot() - If sdgDescribeTwoVarGraph.rdoDotPlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBarDotPlot) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) - ElseIf sdgDescribeTwoVarGraph.rdoBarPlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBarDotPlot) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBarPlotGeom) - End If + clsRFacet.RemoveParameterByName("scale") + Select Case sdgDescribeTwoVarGraph.ucrNumericByNumeric.GetText + Case "Scatter plot" + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) + Case "Line plot" + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) + ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") + Case "Scatter and line plot" + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) + ucrBase.clsRsyntax.AddOperatorParameter("geom_point", clsRFunc:=clsRScatterPlotGeom) + End Select + ElseIf ((strVarType = "numeric" OrElse strVarType = "integer") And (strSecondVarType = "factor" OrElse strSecondVarType = "character" OrElse strSecondVarType = "logical")) Then + clsRFacet.RemoveParameterByName("scale") + ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") + Select Case sdgDescribeTwoVarGraph.ucrNumericByCategorical.GetText + Case "Box plot" + BoxPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBoxAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBoxPlotGeom) + Case "Frequency polygon" + FrequencyPolygon() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRFreqPolyAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRFrequencyPolygonGeom) + Case "Histogram" + Histogram() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRHistAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRHistogramGeom) + Case "Density plot" + DensityPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDensityPlotGeom) + Case "Dot plot" + DotPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) + Case "Point plot" + ScatterLinePlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) + End Select + ElseIf ((strVarType = "factor" OrElse strVarType = "character" OrElse strVarType = "logical") And (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then + ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") + clsRFacet.AddParameter("scale", Chr(34) & "free_x" & Chr(34)) + Select Case sdgDescribeTwoVarGraph.ucrCategoricalByNumeric.GetText + Case "Box plot" + BoxPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBoxAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBoxPlotGeom) + Case "Frequency polygon" + FrequencyPolygon() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRFreqPolyAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRFrequencyPolygonGeom) + Case "Histogram" + Histogram() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRHistAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRHistogramGeom) + Case "Density plot" + DensityPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDensityPlotGeom) + Case "Dot plot" + DotPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) + Case "Point plot" + ScatterLinePlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) + End Select + ElseIf ((strVarType = "factor" OrElse strVarType = "character" OrElse strVarType = "logical") And (strSecondVarType = "factor" OrElse strSecondVarType = "character" OrElse strSecondVarType = "logical")) Then + ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") + clsRFacet.AddParameter("scale", Chr(34) & "free_x" & Chr(34)) + Select Case sdgDescribeTwoVarGraph.ucrCategoricalByCategorical.GetText + Case "Dot plot" + DotPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) + Case "Bar plot" + BarPlot() + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBarPlotGeom) + End Select End If End Sub @@ -130,10 +189,21 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub ucrSecondVariableReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrSecondVariableReceiver.SelectionChanged - clsRBoxAesFunction.AddParameter("fill", ucrSecondVariableReceiver.GetVariableNames(False)) - clsRScatterAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) - clsRBarDotAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) - clsRSummaryAesFunction.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) + If ucrSecondVariableReceiver.IsEmpty() = False Then + clsRScatterAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRBarAesFunction.AddParameter("fill", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRBoxAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRDotAesFunction.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRFreqPolyAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRHistAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRDensityAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRScatterAesFunction2.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRBoxAesFunction2.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRDotAesFunction2.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRFreqPolyAesFunction2.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRHistAesFunction2.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRDensityAesFunction2.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + End If TestOkEnabled() End Sub @@ -142,51 +212,62 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub BoxPlot() - clsRGGBoxPlot.SetOperation("+") clsRBoxPlotGeom.SetRCommand("geom_boxplot") clsRBoxAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBoxAesFunction) - clsRBoxAesFunction.AddParameter("x", Chr(34) & "" & Chr(34)) clsRBoxAesFunction.AddParameter("y", "value") - clsRBoxPlotFacet.SetRCommand("facet_wrap") - clsRBoxPlotFacet.AddParameter("", "~variable") - clsRGGBoxPlot.SetParameter(True, clsRFunc:=clsRGGplotFunction) - clsRGGBoxPlot.SetParameter(False, clsRFunc:=clsRBoxPlotGeom) + clsRBoxAesFunction2.SetRCommand("aes") + clsRBoxAesFunction2.AddParameter("x", "value") End Sub Private Sub ScatterLinePlot() clsRScatterPlotGeom.SetRCommand("geom_point") clsRLinePlotGeom.SetRCommand("geom_line") clsRScatterAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) clsRScatterAesFunction.AddParameter("y", "value") - clsRScatterAesFunction.AddParameter("colour", "variable") + clsRScatterAesFunction2.SetRCommand("aes") + clsRScatterAesFunction2.AddParameter("x", "value") End Sub - Private Sub BarDotPlot() - clsRGGBarDotPlot.SetOperation("+") + + Private Sub DotPlot() clsRDotPlotGeom.SetRCommand("geom_dotplot") + clsRDotPlotGeom.AddParameter("binaxis", Chr(34) & "y" & Chr(34)) + clsRDotAesFunction.SetRCommand("aes") + clsRDotAesFunction.AddParameter("x", "value") + clsRDotAesFunction2.SetRCommand("aes") + clsRDotAesFunction2.AddParameter("y", "value") + End Sub + + Private Sub BarPlot() clsRBarPlotGeom.SetRCommand("geom_bar") - clsRBarDotAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBarDotAesFunction) - clsRBarDotAesFunction.AddParameter("fill", "value") - clsRBarDotPlotFacet.SetRCommand("facet_wrap") - clsRBarDotPlotFacet.AddParameter("", "~variable") - clsRGGBarDotPlot.SetParameter(True, clsRFunc:=clsRGGplotFunction) - clsRGGBarDotPlot.SetParameter(False, clsRFunc:=clsRBarDotPlotFacet) - End Sub - - Private Sub SummaryPlot() - clsRGGSummaryPlot.SetOperation("+") - clsRStatSummary.SetRCommand("stat_summary") - clsRStatSummary.AddParameter("fun.y", Chr(34) & "mean" & Chr(34)) - clsRStatSummary.AddParameter("geom", Chr(34) & "point" & Chr(34)) - clsRSummaryAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRSummaryAesFunction) - clsRSummaryAesFunction.AddParameter("x", "value") - clsRSummaryPlotFacet.SetRCommand("facet_wrap") - clsRSummaryPlotFacet.AddParameter("", "~variable") - clsRGGSummaryPlot.SetParameter(True, clsRFunc:=clsRGGplotFunction) - clsRGGSummaryPlot.SetParameter(False, clsRFunc:=clsRStatSummary) + clsRBarPlotGeom.AddParameter("position", Chr(34) & "dodge" & Chr(34)) + clsRBarAesFunction.SetRCommand("aes") + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBarAesFunction) + clsRBarAesFunction.AddParameter("x", "value") + End Sub + + Private Sub FrequencyPolygon() + clsRFrequencyPolygonGeom.SetRCommand("geom_freqpoly") + clsRFreqPolyAesFunction.SetRCommand("aes") + clsRFreqPolyAesFunction.AddParameter("x", "value") + clsRFreqPolyAesFunction2.SetRCommand("aes") + clsRFreqPolyAesFunction2.AddParameter("color", "value") + End Sub + + Private Sub DensityPlot() + clsRDensityPlotGeom.SetRCommand("geom_density") + clsRDensityAesFunction.SetRCommand("aes") + clsRDensityAesFunction.AddParameter("x", "value") + clsRDensityAesFunction2.SetRCommand("aes") + clsRDensityAesFunction2.AddParameter("color", "value") + End Sub + + Private Sub Histogram() + clsRHistogramGeom.SetRCommand("geom_histogram") + clsRHistogramGeom.AddParameter("position", Chr(34) & "dodge" & Chr(34)) + clsRHistAesFunction.SetRCommand("aes") + clsRHistAesFunction.AddParameter("x", "value") + clsRHistAesFunction2.SetRCommand("aes") + clsRHistAesFunction2.AddParameter("color", "value") End Sub End Class \ No newline at end of file diff --git a/instat/dlgFactorDataFrame.Designer.vb b/instat/dlgFactorDataFrame.Designer.vb index b7b458ed7a8..0cd9f7811d6 100644 --- a/instat/dlgFactorDataFrame.Designer.vb +++ b/instat/dlgFactorDataFrame.Designer.vb @@ -1,9 +1,9 @@ - + _ Partial Class dlgFactorDataFrame 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 @@ -20,34 +20,97 @@ Partial Class dlgFactorDataFrame '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.ucrSelectorFactorDataFrame = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrReceiverFactorDataFrame = New instat.ucrReceiverSingle() + Me.chkReplaceFactorSheet = New System.Windows.Forms.CheckBox() + Me.chkAddCurrentContrast = New System.Windows.Forms.CheckBox() Me.ucrBase = New instat.ucrButtons() + Me.lblSelectedFactor = New System.Windows.Forms.Label() Me.SuspendLayout() ' + 'ucrSelectorFactorDataFrame + ' + Me.ucrSelectorFactorDataFrame.bShowHiddenColumns = False + Me.ucrSelectorFactorDataFrame.bUseCurrentFilter = False + Me.ucrSelectorFactorDataFrame.Location = New System.Drawing.Point(9, 9) + Me.ucrSelectorFactorDataFrame.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorFactorDataFrame.Name = "ucrSelectorFactorDataFrame" + Me.ucrSelectorFactorDataFrame.Size = New System.Drawing.Size(210, 180) + Me.ucrSelectorFactorDataFrame.TabIndex = 0 + ' + 'ucrReceiverFactorDataFrame + ' + Me.ucrReceiverFactorDataFrame.Location = New System.Drawing.Point(256, 111) + Me.ucrReceiverFactorDataFrame.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverFactorDataFrame.Name = "ucrReceiverFactorDataFrame" + Me.ucrReceiverFactorDataFrame.Selector = Nothing + Me.ucrReceiverFactorDataFrame.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverFactorDataFrame.TabIndex = 1 + ' + 'chkReplaceFactorSheet + ' + Me.chkReplaceFactorSheet.AutoSize = True + Me.chkReplaceFactorSheet.Location = New System.Drawing.Point(247, 47) + Me.chkReplaceFactorSheet.Name = "chkReplaceFactorSheet" + Me.chkReplaceFactorSheet.Size = New System.Drawing.Size(166, 17) + Me.chkReplaceFactorSheet.TabIndex = 2 + Me.chkReplaceFactorSheet.Text = "Replace current Factor Sheet" + Me.chkReplaceFactorSheet.UseVisualStyleBackColor = True + ' + 'chkAddCurrentContrast + ' + Me.chkAddCurrentContrast.AutoSize = True + Me.chkAddCurrentContrast.Location = New System.Drawing.Point(247, 16) + Me.chkAddCurrentContrast.Name = "chkAddCurrentContrast" + Me.chkAddCurrentContrast.Size = New System.Drawing.Size(129, 17) + Me.chkAddCurrentContrast.TabIndex = 2 + Me.chkAddCurrentContrast.Text = "Add Current Contrasts" + Me.chkAddCurrentContrast.UseVisualStyleBackColor = True + ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(13, 196) + Me.ucrBase.Location = New System.Drawing.Point(9, 208) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(410, 53) - Me.ucrBase.TabIndex = 0 + Me.ucrBase.Size = New System.Drawing.Size(410, 52) + Me.ucrBase.TabIndex = 3 + ' + 'lblSelectedFactor + ' + Me.lblSelectedFactor.AutoSize = True + Me.lblSelectedFactor.Location = New System.Drawing.Point(253, 95) + Me.lblSelectedFactor.Name = "lblSelectedFactor" + Me.lblSelectedFactor.Size = New System.Drawing.Size(120, 13) + Me.lblSelectedFactor.TabIndex = 4 + Me.lblSelectedFactor.Text = "Selected Factor Column" ' 'dlgFactorDataFrame ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(435, 261) + Me.ClientSize = New System.Drawing.Size(421, 268) + Me.Controls.Add(Me.lblSelectedFactor) Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.chkAddCurrentContrast) + Me.Controls.Add(Me.chkReplaceFactorSheet) + Me.Controls.Add(Me.ucrReceiverFactorDataFrame) + Me.Controls.Add(Me.ucrSelectorFactorDataFrame) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "dlgFactorDataFrame" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Tag = "Factor_Data_Frame" Me.Text = "Factor Data Frame" Me.ResumeLayout(False) + Me.PerformLayout() End Sub + Friend WithEvents ucrSelectorFactorDataFrame As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrReceiverFactorDataFrame As ucrReceiverSingle + Friend WithEvents chkReplaceFactorSheet As CheckBox + Friend WithEvents chkAddCurrentContrast As CheckBox Friend WithEvents ucrBase As ucrButtons + Friend WithEvents lblSelectedFactor As Label End Class diff --git a/instat/dlgFactorDataFrame.vb b/instat/dlgFactorDataFrame.vb index 3457ca2051f..49f9e4764d3 100644 --- a/instat/dlgFactorDataFrame.vb +++ b/instat/dlgFactorDataFrame.vb @@ -13,30 +13,37 @@ ' ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . -Imports instat.Translations +Imports instat.Translations Public Class dlgFactorDataFrame Public bFirstLoad As Boolean = True - - Private Sub dlgFactorDataFrame_Load(sender As Object, e As EventArgs) Handles MyBase.Load - autoTranslate(Me) - - If bFirstLoad Then + Private Sub ucrSelectorFactorDataFrame_Load(sender As Object, e As EventArgs) Handles ucrSelectorFactorDataFrame.Load + If bFirstLoad Then InitialiseDialog() - SetDefaults() + SetDefaults() bFirstLoad = False - End If - End Sub + Else + ReopenDialog() + End If + TestOkEnabled() + autoTranslate(Me) + End Sub Private Sub InitialiseDialog() - ucrBase.iHelpTopicID = 162 - + SetDefaults() + End Sub + Private Sub SetDefaults() + chkAddCurrentContrast.Checked = False + chkReplaceFactorSheet.Checked = False End Sub - Private Sub SetDefaults() - - End Sub - - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset - SetDefaults() + Private Sub ReopenDialog() End Sub + Private Sub TestOkEnabled() + If Not ucrReceiverFactorDataFrame.IsEmpty Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + End Sub + End Class \ No newline at end of file diff --git a/instat/dlgMakeDate.vb b/instat/dlgMakeDate.vb index d0a4e901d0b..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 @@ -79,8 +79,20 @@ 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" & Chr(34)) + Case Else + 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 @@ -124,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 @@ -186,26 +194,24 @@ 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 + DateFormat() + Else + ucrBase.clsRsyntax.RemoveParameter("origin") + End If + End Sub Private Sub Formats() If rdoSpecifyOrigin.Checked Then + ucrReceiverForDate.SetIncludedDataTypes({"numeric"}) ucrInputFormat.Visible = False 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 If Not ucrInputFormat.IsEmpty Then @@ -215,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/dlgOneVarCompareModels.vb b/instat/dlgOneVarCompareModels.vb index aacd9972e13..43addcfb0fe 100644 --- a/instat/dlgOneVarCompareModels.vb +++ b/instat/dlgOneVarCompareModels.vb @@ -17,7 +17,6 @@ Imports instat.Translations Public Class dlgOneVarCompareModels - 'Private clsRcdfcompFunction As New RFunction Public bfirstload As Boolean = True Private Sub dlgOneVarCompareModels_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -33,7 +32,7 @@ Public Class dlgOneVarCompareModels Private Sub InitialiseDialog() sdgOneVarCompareModels.InitialiseDialog() - 'ucrBase.iHelpTopicID = + ucrBase.iHelpTopicID = 174 ucrBase.clsRsyntax.iCallType = 2 UcrReceiver.Selector = ucrSelectorOneVarCompModels UcrReceiver.SetMeAsReceiver() @@ -41,7 +40,8 @@ Public Class dlgOneVarCompareModels ucrSelectorOneVarCompModels.SetItemType("model") sdgOneVarCompareModels.SetModelFunction(ucrBase.clsRsyntax.clsBaseFunction) sdgOneVarCompareModels.SetReceiver(UcrReceiver) - sdgOneVarCompareModels.ChiSqObject() + sdgOneVarCompareModels.DisplayChiSquare() + sdgOneVarCompareModels.DisplayChiBreaks() End Sub Private Sub SetDefaults() @@ -56,10 +56,11 @@ Public Class dlgOneVarCompareModels ' variables not fromvariablex cannot be in dataframe Private Sub ReopenDialog() + sdgOneVarCompareModels.Reopen() End Sub - Private Sub TestOKEnabled() - If Not UcrReceiver.IsEmpty Then + Public Sub TestOKEnabled() + If sdgOneVarCompareModels.TestOkEnabled() AndAlso Not UcrReceiver.IsEmpty Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -71,6 +72,7 @@ Public Class dlgOneVarCompareModels End Sub Private Sub ucrSelectorOneVarCompModels_DataFrameChanged() Handles ucrSelectorOneVarCompModels.DataFrameChanged + sdgOneVarCompareModels.DisplayChiSquare() End Sub Private Sub UcrReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles UcrReceiver.SelectionChanged @@ -87,10 +89,9 @@ Public Class dlgOneVarCompareModels Private Sub cmdDisplayObjects_Click(sender As Object, e As EventArgs) Handles cmdDisplayObjects.Click sdgOneVarCompareModels.ShowDialog() EnableOptions() + TestOKEnabled() End Sub - - Private Sub EnableOptions() If Not UcrReceiver.IsEmpty Then cmdDisplayObjects.Enabled = True diff --git a/instat/dlgOneVarFitModel.vb b/instat/dlgOneVarFitModel.vb index 5490fe7c7a8..5ab64178769 100644 --- a/instat/dlgOneVarFitModel.vb +++ b/instat/dlgOneVarFitModel.vb @@ -34,7 +34,7 @@ Public Class dlgOneVarFitModel sdgOneVarFitModDisplay.InitialiseDialog() sdgOneVarFitModel.InitialiseDialog() UcrBase.clsRsyntax.SetFunction("fitdist") - 'ucrBase.iHelpTopicID = + UcrBase.iHelpTopicID = 296 UcrBase.clsRsyntax.iCallType = 2 UcrReceiver.Selector = ucrSelectorOneVarFitMod UcrReceiver.SetMeAsReceiver() @@ -67,7 +67,7 @@ Public Class dlgOneVarFitModel End Sub Private Sub TestOKEnabled() - If (chkSaveModel.Checked AndAlso Not ucrSaveModel.IsEmpty() OrElse Not chkSaveModel.Checked) AndAlso Not UcrReceiver.IsEmpty Then + If (chkSaveModel.Checked AndAlso Not ucrSaveModel.IsEmpty() OrElse Not chkSaveModel.Checked) AndAlso Not UcrReceiver.IsEmpty AndAlso sdgOneVarFitModDisplay.TestOkEnabled() Then UcrBase.OKEnabled(True) Else UcrBase.OKEnabled(False) @@ -82,13 +82,11 @@ Public Class dlgOneVarFitModel AssignSaveModel() End Sub - Private Sub ucrSaveModel_NameChanged() Handles ucrSaveModel.NameChanged AssignSaveModel() TestOKEnabled() End Sub - Public Sub SetDataParameter() If Not UcrReceiver.IsEmpty Then If UcrReceiver.strCurrDataType = "numeric" OrElse UcrReceiver.strCurrDataType = "integer" Then @@ -123,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() @@ -150,6 +148,7 @@ Public Class dlgOneVarFitModel Private Sub cmdDisplayOptions_Click(sender As Object, e As EventArgs) Handles cmdDisplayOptions.Click sdgOneVarFitModDisplay.ShowDialog() EnableOptions() + TestOKEnabled() End Sub Private Sub EnableOptions() @@ -169,6 +168,12 @@ Public Class dlgOneVarFitModel Private Sub UcrBase_ClickOk(sender As Object, e As EventArgs) Handles UcrBase.ClickOk sdgOneVarFitModDisplay.CreateGraphs() + 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.Designer.vb b/instat/dlgOneVarUseModel.Designer.vb index 1ba6ffae47f..bdc379f2e40 100644 --- a/instat/dlgOneVarUseModel.Designer.vb +++ b/instat/dlgOneVarUseModel.Designer.vb @@ -27,9 +27,9 @@ Partial Class dlgOneVarUseModel Me.cmdBootstrapOptions = New System.Windows.Forms.Button() Me.chkSaveBootstrap = New System.Windows.Forms.CheckBox() Me.chkProduceBootstrap = New System.Windows.Forms.CheckBox() - Me.chkSaveModel = New System.Windows.Forms.CheckBox() + Me.chkSaveDataFrame = New System.Windows.Forms.CheckBox() Me.ucrSaveObjects = New instat.ucrInputComboBox() - Me.ucrSaveModel = New instat.ucrInputComboBox() + Me.ucrNewDataframeName = New instat.ucrInputComboBox() Me.ucrBase = New instat.ucrButtons() Me.ucrReceiver = New instat.ucrReceiverSingle() Me.ucrSelector = New instat.ucrSelectorByDataFrameAddRemove() @@ -46,7 +46,7 @@ Partial Class dlgOneVarUseModel ' 'cmdFitModel ' - Me.cmdFitModel.Location = New System.Drawing.Point(239, 200) + Me.cmdFitModel.Location = New System.Drawing.Point(275, 201) Me.cmdFitModel.Name = "cmdFitModel" Me.cmdFitModel.Size = New System.Drawing.Size(101, 23) Me.cmdFitModel.TabIndex = 13 @@ -55,7 +55,7 @@ Partial Class dlgOneVarUseModel ' 'cmdBootstrapOptions ' - Me.cmdBootstrapOptions.Location = New System.Drawing.Point(239, 167) + Me.cmdBootstrapOptions.Location = New System.Drawing.Point(275, 167) Me.cmdBootstrapOptions.Name = "cmdBootstrapOptions" Me.cmdBootstrapOptions.Size = New System.Drawing.Size(101, 23) Me.cmdBootstrapOptions.TabIndex = 12 @@ -82,15 +82,15 @@ Partial Class dlgOneVarUseModel Me.chkProduceBootstrap.Text = "Produce Bootstrap" Me.chkProduceBootstrap.UseVisualStyleBackColor = True ' - 'chkSaveModel + 'chkSaveDataFrame ' - Me.chkSaveModel.AutoSize = True - Me.chkSaveModel.Location = New System.Drawing.Point(10, 204) - Me.chkSaveModel.Name = "chkSaveModel" - Me.chkSaveModel.Size = New System.Drawing.Size(86, 17) - Me.chkSaveModel.TabIndex = 21 - Me.chkSaveModel.Text = "Save Model:" - Me.chkSaveModel.UseVisualStyleBackColor = True + Me.chkSaveDataFrame.AutoSize = True + Me.chkSaveDataFrame.Location = New System.Drawing.Point(10, 204) + Me.chkSaveDataFrame.Name = "chkSaveDataFrame" + Me.chkSaveDataFrame.Size = New System.Drawing.Size(115, 17) + Me.chkSaveDataFrame.TabIndex = 21 + Me.chkSaveDataFrame.Text = "Save to Dataframe" + Me.chkSaveDataFrame.UseVisualStyleBackColor = True ' 'ucrSaveObjects ' @@ -100,13 +100,13 @@ Partial Class dlgOneVarUseModel Me.ucrSaveObjects.Size = New System.Drawing.Size(137, 21) Me.ucrSaveObjects.TabIndex = 22 ' - 'ucrSaveModel + 'ucrNewDataframeName ' - Me.ucrSaveModel.IsReadOnly = False - Me.ucrSaveModel.Location = New System.Drawing.Point(92, 202) - Me.ucrSaveModel.Name = "ucrSaveModel" - Me.ucrSaveModel.Size = New System.Drawing.Size(137, 21) - Me.ucrSaveModel.TabIndex = 20 + Me.ucrNewDataframeName.IsReadOnly = False + Me.ucrNewDataframeName.Location = New System.Drawing.Point(128, 202) + Me.ucrNewDataframeName.Name = "ucrNewDataframeName" + Me.ucrNewDataframeName.Size = New System.Drawing.Size(138, 21) + Me.ucrNewDataframeName.TabIndex = 20 ' 'ucrBase ' @@ -138,9 +138,9 @@ Partial Class dlgOneVarUseModel ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(425, 302) + Me.ClientSize = New System.Drawing.Size(423, 291) Me.Controls.Add(Me.ucrSaveObjects) - Me.Controls.Add(Me.ucrSaveModel) + Me.Controls.Add(Me.ucrNewDataframeName) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.lblReceiver) Me.Controls.Add(Me.ucrReceiver) @@ -149,7 +149,7 @@ Partial Class dlgOneVarUseModel Me.Controls.Add(Me.cmdBootstrapOptions) Me.Controls.Add(Me.chkSaveBootstrap) Me.Controls.Add(Me.chkProduceBootstrap) - Me.Controls.Add(Me.chkSaveModel) + Me.Controls.Add(Me.chkSaveDataFrame) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -168,7 +168,7 @@ Partial Class dlgOneVarUseModel Friend WithEvents cmdBootstrapOptions As Button Friend WithEvents chkSaveBootstrap As CheckBox Friend WithEvents chkProduceBootstrap As CheckBox - Friend WithEvents chkSaveModel As CheckBox - Friend WithEvents ucrSaveModel As ucrInputComboBox + Friend WithEvents chkSaveDataFrame As CheckBox + Friend WithEvents ucrNewDataframeName As ucrInputComboBox Friend WithEvents ucrSaveObjects As ucrInputComboBox End Class diff --git a/instat/dlgOneVarUseModel.vb b/instat/dlgOneVarUseModel.vb index 93a327678d6..81403ccef4e 100644 --- a/instat/dlgOneVarUseModel.vb +++ b/instat/dlgOneVarUseModel.vb @@ -34,16 +34,16 @@ Public Class dlgOneVarUseModel Private Sub InitialiseDialog() sdgOneVarUseModBootstrap.InitialiseDialog() sdgOneVarUseModFit.InitialiseDialog() - 'ucrBase.iHelpTopicID = + ucrBase.iHelpTopicID = 375 ucrBase.clsRsyntax.iCallType = 2 ucrReceiver.Selector = ucrSelector ucrReceiver.SetMeAsReceiver() - ucrSaveModel.SetDataFrameSelector(ucrSelector.ucrAvailableDataFrames) - ucrSaveModel.SetPrefix("model") + ucrNewDataframeName.SetDataFrameSelector(ucrSelector.ucrAvailableDataFrames) + ucrNewDataframeName.SetPrefix("UseModel") ucrBase.clsRsyntax.SetFunction("quantile") - ucrSaveModel.SetItemsTypeAsModels() - ucrSaveModel.SetDefaultTypeAsModel() - ucrSaveModel.SetValidationTypeAsRVariable() + ucrNewDataframeName.SetItemsTypeAsModels() + ucrNewDataframeName.SetDefaultTypeAsModel() + ucrNewDataframeName.SetValidationTypeAsRVariable() ucrSaveObjects.SetName("bootstrap") ucrSaveObjects.SetItemsTypeAsModels() ucrSaveObjects.SetDefaultTypeAsModel() @@ -62,10 +62,10 @@ Public Class dlgOneVarUseModel ucrSelector.Focus() sdgOneVarUseModBootstrap.SetDefaults() sdgOneVarUseModFit.SetDefaults() - chkSaveModel.Checked = True + chkSaveDataFrame.Checked = True ucrSaveObjects.Visible = False ucrSaveObjects.Reset() - ucrSaveModel.Reset() + ucrNewDataframeName.Reset() chkProduceBootstrap.Enabled = False chkProduceBootstrap.Checked = False chkSaveBootstrap.Visible = False @@ -81,7 +81,7 @@ Public Class dlgOneVarUseModel End Sub Private Sub TestOKEnabled() - If (chkSaveModel.Checked AndAlso Not ucrSaveModel.IsEmpty() OrElse Not chkSaveModel.Checked) AndAlso Not ucrReceiver.IsEmpty AndAlso (chkSaveBootstrap.Checked AndAlso Not ucrSaveObjects.IsEmpty() OrElse Not chkSaveBootstrap.Checked) Then + If Not ucrReceiver.IsEmpty AndAlso (chkSaveBootstrap.Checked AndAlso Not ucrSaveObjects.IsEmpty() OrElse Not chkSaveBootstrap.Checked) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -93,17 +93,17 @@ Public Class dlgOneVarUseModel End Sub Private Sub ucrSelector_DataFrameChanged() Handles ucrSelector.DataFrameChanged - AssignSaveModel() + AssignSavetoDataFrame() ' AssignSaveObjects() End Sub - Private Sub ucrSaveModel_NameChanged() Handles ucrSaveModel.NameChanged - AssignSaveModel() - TestOKEnabled() - End Sub + ' Private Sub ucrSaveModel_NameChanged() Handles ucrSaveModel.NameChanged + ' AssignSaveModel() + ' TestOKEnabled() + ' End Sub Private Sub ucrSaveObjects_NameChanged() Handles ucrSaveObjects.NameChanged - ' AssignSaveObjects() + 'AssignSaveObjects() TestOKEnabled() End Sub @@ -118,32 +118,22 @@ Public Class dlgOneVarUseModel End Sub - Private Sub AssignSaveModel() - If chkSaveModel.Checked AndAlso Not ucrSaveModel.IsEmpty Then - ucrBase.clsRsyntax.SetAssignTo(ucrSaveModel.GetText, strTempModel:=ucrSaveModel.GetText, strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + Private Sub AssignSavetoDataFrame() + If chkSaveDataFrame.Checked AndAlso Not ucrNewDataframeName.IsEmpty Then + ucrBase.clsRsyntax.SetAssignTo(ucrNewDataframeName.GetText, strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) Else ucrBase.clsRsyntax.SetAssignTo("last_model", strTempModel:="last_model", strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) End If End Sub - ' Private Sub AssignSaveObjects() - 'If chkSaveBootstrap.Checked AndAlso Not ucrSaveObjects.IsEmpty Then - ' ucrBase.clsRsyntax.SetAssignTo(ucrSaveObjects.GetText, strTempModel:=ucrSaveObjects.GetText, strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) - 'Else - ' ucrBase.clsRsyntax.SetAssignTo("last_bootstrap", strTempModel:="last_bootstrap", strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + ' Private Sub AssignSaveObjects() + ' If chkSaveBootstrap.Checked AndAlso Not ucrSaveObjects.IsEmpty Then + '' ucrBase.clsRsyntax.SetAssignTo(ucrSaveObjects.GetText, strTempModel:=ucrSaveObjects.GetText, strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + ''Else + '' ucrBase.clsRsyntax.SetAssignTo("last_bootstrap", strTempModel:="last_bootstrap", strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) 'End If 'End Sub - Private Sub chkSaveModel_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveModel.CheckedChanged - If chkSaveModel.Checked Then - ucrSaveModel.Enabled = True - Else - ucrSaveModel.Enabled = False - End If - AssignSaveModel() - TestOKEnabled() - End Sub - Private Sub chkSaveBootstrap_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveBootstrap.CheckedChanged If Not chkSaveBootstrap.Checked Then ucrSaveObjects.Visible = False @@ -197,7 +187,9 @@ Public Class dlgOneVarUseModel End Sub Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk - frmMain.clsRLink.RunScript(clsRbootFunction.ToScript(), bReturnOutput:=2) + If chkProduceBootstrap.Checked Then + frmMain.clsRLink.RunScript(clsRbootFunction.ToScript(), bReturnOutput:=2) + End If End Sub End Class \ No newline at end of file diff --git a/instat/dlgOneVariableGraph.vb b/instat/dlgOneVariableGraph.vb index eed5433e29d..894b4542b0f 100644 --- a/instat/dlgOneVariableGraph.vb +++ b/instat/dlgOneVariableGraph.vb @@ -87,11 +87,13 @@ Public Class dlgOneVariableGraph 'TODO Geom should come from the subdialog clsRaesFunction.ClearParameters() clsRgeom_Function.SetRCommand(sdgOneVarGraph.strNumericGeomFunction) - If Not ucrReceiverOneVarGraph.IsEmpty() Then + + If Not ucrReceiverOneVarGraph.IsEmpty() AndAlso (sdgOneVarGraph.ucrInputNumeric.GetText = "Boxplot" OrElse sdgOneVarGraph.ucrInputNumeric.GetText = "Dot Plot" OrElse sdgOneVarGraph.ucrInputNumeric.GetText = "Point Plot") Then + clsRaesFunction.AddParameter("x", Chr(34) & Chr(34)) clsRaesFunction.AddParameter("y", ucrReceiverOneVarGraph.GetVariableNames(False)) + ElseIf Not ucrReceiverOneVarGraph.IsEmpty() AndAlso (sdgOneVarGraph.ucrInputNumeric.GetText = "Histogram" OrElse sdgOneVarGraph.ucrInputNumeric.GetText = "Density Plot" OrElse sdgOneVarGraph.ucrInputNumeric.GetText = "Frequency Polygon") Then + clsRaesFunction.AddParameter("x", ucrReceiverOneVarGraph.GetVariableNames(False)) End If - - clsRaesFunction.AddParameter("x", Chr(34) & Chr(34)) Else clsRaesFunction.ClearParameters() 'TODO Geom should come from the subdialog @@ -99,6 +101,16 @@ Public Class dlgOneVariableGraph If Not ucrReceiverOneVarGraph.IsEmpty() Then clsRaesFunction.AddParameter("x", ucrReceiverOneVarGraph.GetVariableNames(False)) End If + If sdgOneVarGraph.ucrInputCategorical.GetText = "Pie Chart" Then + Dim clsTempRFunc As New RFunction + clsRgeom_Function.AddParameter("width", "1") + clsTempRFunc.SetRCommand("coord_polar") + clsTempRFunc.AddParameter("theta", Chr(34) & "y" & Chr(34)) + ucrBase.clsRsyntax.AddOperatorParameter("polar", clsRFunc:=clsTempRFunc) + Else + clsRgeom_Function.RemoveParameterByName("width") + ucrBase.clsRsyntax.RemoveOperatorParameter("polar") + End If End If Else ucrBase.clsRsyntax.SetBaseRFunction(clsBaseFunctionMultipleVariables) 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 diff --git a/instat/sdgDescribeTwoVarGraph.Designer.vb b/instat/sdgDescribeTwoVarGraph.Designer.vb index 173ec139e47..48afd26943b 100644 --- a/instat/sdgDescribeTwoVarGraph.Designer.vb +++ b/instat/sdgDescribeTwoVarGraph.Designer.vb @@ -23,183 +23,126 @@ Partial Class sdgDescribeTwoVarGraph _ Private Sub InitializeComponent() Me.UcrButtonsSubdialogue1 = New instat.ucrButtonsSubdialogue() - Me.grpVariateByVariate = New System.Windows.Forms.GroupBox() - Me.rdoLinePlot = New System.Windows.Forms.RadioButton() - Me.rdoScatterPlot = New System.Windows.Forms.RadioButton() - Me.grpVariateByFactor = New System.Windows.Forms.GroupBox() - Me.rdoBoxPlot = New System.Windows.Forms.RadioButton() - Me.grpFactorByVariate = New System.Windows.Forms.GroupBox() - Me.rdoSummaryPlot = New System.Windows.Forms.RadioButton() - Me.grpFactorByFactor = New System.Windows.Forms.GroupBox() - Me.rdoDotPlot = New System.Windows.Forms.RadioButton() - Me.rdoBarPlot = New System.Windows.Forms.RadioButton() - Me.grpVariateByVariate.SuspendLayout() - Me.grpVariateByFactor.SuspendLayout() - Me.grpFactorByVariate.SuspendLayout() - Me.grpFactorByFactor.SuspendLayout() + Me.ucrNumericByNumeric = New instat.ucrInputComboBox() + Me.lblNumericByNumeric = New System.Windows.Forms.Label() + Me.lblNumericByCategorical = New System.Windows.Forms.Label() + Me.ucrNumericByCategorical = New instat.ucrInputComboBox() + Me.lblCategoricalByCategorical = New System.Windows.Forms.Label() + Me.ucrCategoricalByCategorical = New instat.ucrInputComboBox() + Me.lblCategoricalByNumeric = New System.Windows.Forms.Label() + Me.ucrCategoricalByNumeric = New instat.ucrInputComboBox() Me.SuspendLayout() ' 'UcrButtonsSubdialogue1 ' - Me.UcrButtonsSubdialogue1.Location = New System.Drawing.Point(76, 219) + Me.UcrButtonsSubdialogue1.Location = New System.Drawing.Point(66, 143) Me.UcrButtonsSubdialogue1.Name = "UcrButtonsSubdialogue1" Me.UcrButtonsSubdialogue1.Size = New System.Drawing.Size(142, 30) - Me.UcrButtonsSubdialogue1.TabIndex = 0 - ' - 'grpVariateByVariate - ' - Me.grpVariateByVariate.Controls.Add(Me.rdoLinePlot) - Me.grpVariateByVariate.Controls.Add(Me.rdoScatterPlot) - Me.grpVariateByVariate.Location = New System.Drawing.Point(12, 12) - Me.grpVariateByVariate.Name = "grpVariateByVariate" - Me.grpVariateByVariate.Size = New System.Drawing.Size(260, 42) - Me.grpVariateByVariate.TabIndex = 114 - Me.grpVariateByVariate.TabStop = False - Me.grpVariateByVariate.Tag = "Variate_By_Variate" - Me.grpVariateByVariate.Text = "Variate By Variate" - ' - 'rdoLinePlot - ' - Me.rdoLinePlot.AutoSize = True - Me.rdoLinePlot.Location = New System.Drawing.Point(159, 18) - Me.rdoLinePlot.Name = "rdoLinePlot" - Me.rdoLinePlot.Size = New System.Drawing.Size(63, 17) - Me.rdoLinePlot.TabIndex = 116 - Me.rdoLinePlot.TabStop = True - Me.rdoLinePlot.Tag = "LinePlot" - Me.rdoLinePlot.Text = "LinePlot" - Me.rdoLinePlot.UseVisualStyleBackColor = True - ' - 'rdoScatterPlot - ' - Me.rdoScatterPlot.AutoSize = True - Me.rdoScatterPlot.Location = New System.Drawing.Point(14, 17) - Me.rdoScatterPlot.Name = "rdoScatterPlot" - Me.rdoScatterPlot.Size = New System.Drawing.Size(77, 17) - Me.rdoScatterPlot.TabIndex = 115 - Me.rdoScatterPlot.TabStop = True - Me.rdoScatterPlot.Tag = "ScatterPlot" - Me.rdoScatterPlot.Text = "ScatterPlot" - Me.rdoScatterPlot.UseVisualStyleBackColor = True - ' - 'grpVariateByFactor - ' - Me.grpVariateByFactor.Controls.Add(Me.rdoBoxPlot) - Me.grpVariateByFactor.Location = New System.Drawing.Point(12, 57) - Me.grpVariateByFactor.Name = "grpVariateByFactor" - Me.grpVariateByFactor.Size = New System.Drawing.Size(260, 46) - Me.grpVariateByFactor.TabIndex = 113 - Me.grpVariateByFactor.TabStop = False - Me.grpVariateByFactor.Tag = "Variate_By_Factor" - Me.grpVariateByFactor.Text = "Variate By Factor" - ' - 'rdoBoxPlot - ' - Me.rdoBoxPlot.AutoSize = True - Me.rdoBoxPlot.Location = New System.Drawing.Point(14, 23) - Me.rdoBoxPlot.Name = "rdoBoxPlot" - Me.rdoBoxPlot.Size = New System.Drawing.Size(61, 17) - Me.rdoBoxPlot.TabIndex = 117 - Me.rdoBoxPlot.TabStop = True - Me.rdoBoxPlot.Tag = "BoxPlot" - Me.rdoBoxPlot.Text = "BoxPlot" - Me.rdoBoxPlot.UseVisualStyleBackColor = True - ' - 'grpFactorByVariate - ' - Me.grpFactorByVariate.Controls.Add(Me.rdoSummaryPlot) - Me.grpFactorByVariate.Location = New System.Drawing.Point(12, 116) - Me.grpFactorByVariate.Name = "grpFactorByVariate" - Me.grpFactorByVariate.Size = New System.Drawing.Size(260, 43) - Me.grpFactorByVariate.TabIndex = 114 - Me.grpFactorByVariate.TabStop = False - Me.grpFactorByVariate.Tag = "Factor_By_Variate" - Me.grpFactorByVariate.Text = "Factor By Variate" - ' - 'rdoSummaryPlot - ' - Me.rdoSummaryPlot.AutoSize = True - Me.rdoSummaryPlot.Location = New System.Drawing.Point(14, 19) - Me.rdoSummaryPlot.Name = "rdoSummaryPlot" - Me.rdoSummaryPlot.Size = New System.Drawing.Size(86, 17) - Me.rdoSummaryPlot.TabIndex = 120 - Me.rdoSummaryPlot.TabStop = True - Me.rdoSummaryPlot.Tag = "SummaryPlot" - Me.rdoSummaryPlot.Text = "SummaryPlot" - Me.rdoSummaryPlot.UseVisualStyleBackColor = True - ' - 'grpFactorByFactor - ' - Me.grpFactorByFactor.Controls.Add(Me.rdoDotPlot) - Me.grpFactorByFactor.Controls.Add(Me.rdoBarPlot) - Me.grpFactorByFactor.Location = New System.Drawing.Point(12, 165) - Me.grpFactorByFactor.Name = "grpFactorByFactor" - Me.grpFactorByFactor.Size = New System.Drawing.Size(260, 42) - Me.grpFactorByFactor.TabIndex = 114 - Me.grpFactorByFactor.TabStop = False - Me.grpFactorByFactor.Tag = "Factor_By_Factor" - Me.grpFactorByFactor.Text = "Factor By Factor" - ' - 'rdoDotPlot - ' - Me.rdoDotPlot.AutoSize = True - Me.rdoDotPlot.Location = New System.Drawing.Point(159, 15) - Me.rdoDotPlot.Name = "rdoDotPlot" - Me.rdoDotPlot.Size = New System.Drawing.Size(60, 17) - Me.rdoDotPlot.TabIndex = 119 - Me.rdoDotPlot.TabStop = True - Me.rdoDotPlot.Tag = "DotPlot" - Me.rdoDotPlot.Text = "DotPlot" - Me.rdoDotPlot.UseVisualStyleBackColor = True - ' - 'rdoBarPlot - ' - Me.rdoBarPlot.AutoSize = True - Me.rdoBarPlot.Location = New System.Drawing.Point(14, 15) - Me.rdoBarPlot.Name = "rdoBarPlot" - Me.rdoBarPlot.Size = New System.Drawing.Size(59, 17) - Me.rdoBarPlot.TabIndex = 118 - Me.rdoBarPlot.TabStop = True - Me.rdoBarPlot.Tag = "BarPlot" - Me.rdoBarPlot.Text = "BarPlot" - Me.rdoBarPlot.UseVisualStyleBackColor = True + Me.UcrButtonsSubdialogue1.TabIndex = 8 + ' + 'ucrNumericByNumeric + ' + Me.ucrNumericByNumeric.IsReadOnly = False + Me.ucrNumericByNumeric.Location = New System.Drawing.Point(148, 11) + Me.ucrNumericByNumeric.Name = "ucrNumericByNumeric" + Me.ucrNumericByNumeric.Size = New System.Drawing.Size(144, 21) + Me.ucrNumericByNumeric.TabIndex = 1 + ' + 'lblNumericByNumeric + ' + Me.lblNumericByNumeric.AutoSize = True + Me.lblNumericByNumeric.Location = New System.Drawing.Point(9, 17) + Me.lblNumericByNumeric.Name = "lblNumericByNumeric" + Me.lblNumericByNumeric.Size = New System.Drawing.Size(102, 13) + Me.lblNumericByNumeric.TabIndex = 0 + Me.lblNumericByNumeric.Tag = "Numeric_by_Numeric" + Me.lblNumericByNumeric.Text = "Numeric by Numeric" + ' + 'lblNumericByCategorical + ' + Me.lblNumericByCategorical.AutoSize = True + Me.lblNumericByCategorical.Location = New System.Drawing.Point(9, 49) + Me.lblNumericByCategorical.Name = "lblNumericByCategorical" + Me.lblNumericByCategorical.Size = New System.Drawing.Size(116, 13) + Me.lblNumericByCategorical.TabIndex = 2 + Me.lblNumericByCategorical.Tag = "Numeric_by_Categorical" + Me.lblNumericByCategorical.Text = "Numeric by Categorical" + ' + 'ucrNumericByCategorical + ' + Me.ucrNumericByCategorical.IsReadOnly = False + Me.ucrNumericByCategorical.Location = New System.Drawing.Point(148, 43) + Me.ucrNumericByCategorical.Name = "ucrNumericByCategorical" + Me.ucrNumericByCategorical.Size = New System.Drawing.Size(144, 21) + Me.ucrNumericByCategorical.TabIndex = 3 + ' + 'lblCategoricalByCategorical + ' + Me.lblCategoricalByCategorical.AutoSize = True + Me.lblCategoricalByCategorical.Location = New System.Drawing.Point(9, 113) + Me.lblCategoricalByCategorical.Name = "lblCategoricalByCategorical" + Me.lblCategoricalByCategorical.Size = New System.Drawing.Size(130, 13) + Me.lblCategoricalByCategorical.TabIndex = 6 + Me.lblCategoricalByCategorical.Tag = "Categorical_by_Categorical" + Me.lblCategoricalByCategorical.Text = "Categorical by Categorical" + ' + 'ucrCategoricalByCategorical + ' + Me.ucrCategoricalByCategorical.IsReadOnly = False + Me.ucrCategoricalByCategorical.Location = New System.Drawing.Point(148, 107) + Me.ucrCategoricalByCategorical.Name = "ucrCategoricalByCategorical" + Me.ucrCategoricalByCategorical.Size = New System.Drawing.Size(144, 21) + Me.ucrCategoricalByCategorical.TabIndex = 7 + ' + 'lblCategoricalByNumeric + ' + Me.lblCategoricalByNumeric.AutoSize = True + Me.lblCategoricalByNumeric.Location = New System.Drawing.Point(9, 81) + Me.lblCategoricalByNumeric.Name = "lblCategoricalByNumeric" + Me.lblCategoricalByNumeric.Size = New System.Drawing.Size(116, 13) + Me.lblCategoricalByNumeric.TabIndex = 4 + Me.lblCategoricalByNumeric.Tag = "Categorical_by_Numeric" + Me.lblCategoricalByNumeric.Text = "Categorical by Numeric" + ' + 'ucrCategoricalByNumeric + ' + Me.ucrCategoricalByNumeric.IsReadOnly = False + Me.ucrCategoricalByNumeric.Location = New System.Drawing.Point(148, 75) + Me.ucrCategoricalByNumeric.Name = "ucrCategoricalByNumeric" + Me.ucrCategoricalByNumeric.Size = New System.Drawing.Size(144, 21) + Me.ucrCategoricalByNumeric.TabIndex = 5 ' 'sdgDescribeTwoVarGraph ' 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.grpFactorByFactor) - Me.Controls.Add(Me.grpFactorByVariate) - Me.Controls.Add(Me.grpVariateByVariate) - Me.Controls.Add(Me.grpVariateByFactor) + Me.ClientSize = New System.Drawing.Size(302, 177) + Me.Controls.Add(Me.lblCategoricalByCategorical) + Me.Controls.Add(Me.ucrCategoricalByCategorical) + Me.Controls.Add(Me.lblCategoricalByNumeric) + Me.Controls.Add(Me.ucrCategoricalByNumeric) + Me.Controls.Add(Me.lblNumericByCategorical) + Me.Controls.Add(Me.ucrNumericByCategorical) + Me.Controls.Add(Me.lblNumericByNumeric) + Me.Controls.Add(Me.ucrNumericByNumeric) Me.Controls.Add(Me.UcrButtonsSubdialogue1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "sdgDescribeTwoVarGraph" Me.Text = "Two Variable Graph" - Me.grpVariateByVariate.ResumeLayout(False) - Me.grpVariateByVariate.PerformLayout() - Me.grpVariateByFactor.ResumeLayout(False) - Me.grpVariateByFactor.PerformLayout() - Me.grpFactorByVariate.ResumeLayout(False) - Me.grpFactorByVariate.PerformLayout() - Me.grpFactorByFactor.ResumeLayout(False) - Me.grpFactorByFactor.PerformLayout() Me.ResumeLayout(False) + Me.PerformLayout() End Sub Friend WithEvents UcrButtonsSubdialogue1 As ucrButtonsSubdialogue - Friend WithEvents grpVariateByVariate As GroupBox - Friend WithEvents rdoLinePlot As RadioButton - Friend WithEvents rdoScatterPlot As RadioButton - Friend WithEvents grpVariateByFactor As GroupBox - Friend WithEvents rdoBoxPlot As RadioButton - Friend WithEvents grpFactorByVariate As GroupBox - Friend WithEvents rdoSummaryPlot As RadioButton - Friend WithEvents grpFactorByFactor As GroupBox - Friend WithEvents rdoDotPlot As RadioButton - Friend WithEvents rdoBarPlot As RadioButton + Friend WithEvents ucrNumericByNumeric As ucrInputComboBox + Friend WithEvents lblNumericByNumeric As Label + Friend WithEvents lblNumericByCategorical As Label + Friend WithEvents ucrNumericByCategorical As ucrInputComboBox + Friend WithEvents lblCategoricalByCategorical As Label + Friend WithEvents ucrCategoricalByCategorical As ucrInputComboBox + Friend WithEvents lblCategoricalByNumeric As Label + Friend WithEvents ucrCategoricalByNumeric As ucrInputComboBox End Class diff --git a/instat/sdgDescribeTwoVarGraph.vb b/instat/sdgDescribeTwoVarGraph.vb index 7458b73c2b0..aa15dc628a3 100644 --- a/instat/sdgDescribeTwoVarGraph.vb +++ b/instat/sdgDescribeTwoVarGraph.vb @@ -20,79 +20,58 @@ Public Class sdgDescribeTwoVarGraph autoTranslate(Me) If bFirstLoad Then - SetDefaults() + 'SetDefaults() bFirstLoad = False End If End Sub Public Sub SetDefaults() - grpVariateByVariate.Enabled = True - grpVariateByFactor.Enabled = True - grpFactorByVariate.Enabled = True - grpFactorByFactor.Enabled = True - rdoScatterPlot.Enabled = True - rdoLinePlot.Enabled = True - rdoBoxPlot.Enabled = True - rdoSummaryPlot.Enabled = True - rdoBarPlot.Enabled = True - rdoDotPlot.Enabled = True - rdoScatterPlot.Checked = True - rdoLinePlot.Checked = False - rdoBoxPlot.Checked = True - rdoSummaryPlot.Checked = True - rdoBarPlot.Checked = True - rdoDotPlot.Checked = False + ucrNumericByNumeric.Enabled = False + ucrNumericByCategorical.Enabled = False + ucrCategoricalByNumeric.Enabled = False + ucrCategoricalByCategorical.Enabled = False + GraphOptions() End Sub - Private Sub rdoTwoVarGraphs_CheckedChanged(sender As Object, e As EventArgs) Handles rdoBarPlot.CheckedChanged, rdoLinePlot.CheckedChanged, rdoBoxPlot.CheckedChanged, rdoSummaryPlot.CheckedChanged, rdoDotPlot.CheckedChanged, rdoScatterPlot.CheckedChanged - dlgDescribeTwoVarGraph.Results() + Private Sub GraphOptions() + ucrNumericByNumeric.SetItems({"Scatter plot", "Line plot", "Scatter and line plot"}) + ucrNumericByNumeric.cboInput.SelectedItem = "Scatter plot" + ucrNumericByCategorical.SetItems({"Box plot", "Histogram", "Density plot", "Frequency polygon", "Dot plot", "Point plot"}) + 'How different is the point plot from the summary plot? + ucrNumericByCategorical.cboInput.SelectedItem = "Box plot" + 'ucrCategoricalByNumeric.SetItems({"Summary plot"}) + ucrCategoricalByNumeric.SetItems({"Box plot", "Histogram", "Density plot", "Frequency polygon", "Dot plot", "Point plot"}) + ucrCategoricalByNumeric.cboInput.SelectedItem = "Box plot" + ucrCategoricalByCategorical.SetItems({"Bar plot", "Dot plot"}) + ucrCategoricalByCategorical.cboInput.SelectedItem = "Bar plot" End Sub Public Sub GrpBoxEnable() If ((dlgDescribeTwoVarGraph.strVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strVarType = "integer") And (dlgDescribeTwoVarGraph.strSecondVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "integer")) Then - grpVariateByVariate.Enabled = True - grpVariateByFactor.Enabled = False - grpFactorByVariate.Enabled = False - grpFactorByFactor.Enabled = False - rdoScatterPlot.Enabled = True - rdoLinePlot.Enabled = True - rdoBoxPlot.Enabled = False - rdoSummaryPlot.Enabled = False - rdoBarPlot.Enabled = False - rdoDotPlot.Enabled = False - ElseIf ((dlgDescribeTwoVarGraph.strVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strVarType = "integer") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor")) Then - grpVariateByVariate.Enabled = False - grpVariateByFactor.Enabled = True - grpFactorByVariate.Enabled = False - grpFactorByFactor.Enabled = False - rdoScatterPlot.Enabled = False - rdoLinePlot.Enabled = False - rdoBoxPlot.Enabled = True - rdoSummaryPlot.Enabled = False - rdoBarPlot.Enabled = False - rdoDotPlot.Enabled = False - ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor") And (dlgDescribeTwoVarGraph.strSecondVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "integer")) Then - grpVariateByVariate.Enabled = False - grpVariateByFactor.Enabled = False - grpFactorByVariate.Enabled = True - grpFactorByFactor.Enabled = False - rdoScatterPlot.Enabled = False - rdoLinePlot.Enabled = False - rdoBoxPlot.Enabled = False - rdoSummaryPlot.Enabled = True - rdoBarPlot.Enabled = False - rdoDotPlot.Enabled = False - ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor")) Then - grpVariateByVariate.Enabled = False - grpVariateByFactor.Enabled = False - grpFactorByVariate.Enabled = False - grpFactorByFactor.Enabled = True - rdoScatterPlot.Enabled = False - rdoLinePlot.Enabled = False - rdoBoxPlot.Enabled = False - rdoSummaryPlot.Enabled = False - rdoBarPlot.Enabled = True - rdoDotPlot.Enabled = True + ucrNumericByNumeric.Enabled = True + ucrNumericByCategorical.Enabled = False + ucrCategoricalByNumeric.Enabled = False + ucrCategoricalByCategorical.Enabled = False + ElseIf ((dlgDescribeTwoVarGraph.strVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strVarType = "integer") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "character" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "logical")) Then + ucrNumericByNumeric.Enabled = False + ucrNumericByCategorical.Enabled = True + ucrCategoricalByNumeric.Enabled = False + ucrCategoricalByCategorical.Enabled = False + ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor" OrElse dlgDescribeTwoVarGraph.strVarType = "character" OrElse dlgDescribeTwoVarGraph.strVarType = "logical") And (dlgDescribeTwoVarGraph.strSecondVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "integer")) Then + ucrNumericByNumeric.Enabled = False + ucrNumericByCategorical.Enabled = False + ucrCategoricalByNumeric.Enabled = True + ucrCategoricalByCategorical.Enabled = False + ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor" OrElse dlgDescribeTwoVarGraph.strVarType = "character" OrElse dlgDescribeTwoVarGraph.strVarType = "logical") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "character" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "logical")) Then + ucrNumericByNumeric.Enabled = False + ucrNumericByCategorical.Enabled = False + ucrCategoricalByNumeric.Enabled = False + lblCategoricalByCategorical.Enabled = True + ucrCategoricalByCategorical.Enabled = True End If End Sub + + Private Sub ucrGraphs_NameChanged() Handles ucrNumericByNumeric.NameChanged, ucrNumericByCategorical.NameChanged, ucrCategoricalByNumeric.NameChanged, ucrCategoricalByCategorical.NameChanged + dlgDescribeTwoVarGraph.Results() + End Sub End Class \ No newline at end of file diff --git a/instat/sdgOneVarCompareModels.Designer.vb b/instat/sdgOneVarCompareModels.Designer.vb index 3c086fefb85..e21ad26a0f6 100644 --- a/instat/sdgOneVarCompareModels.Designer.vb +++ b/instat/sdgOneVarCompareModels.Designer.vb @@ -36,6 +36,7 @@ Partial Class sdgOneVarCompareModels Me.chkCDF = New System.Windows.Forms.CheckBox() Me.chkPP = New System.Windows.Forms.CheckBox() Me.chkDensity = New System.Windows.Forms.CheckBox() + Me.ucrDisplayChiData = New instat.ucrInputTextBox() Me.TabControl1.SuspendLayout() Me.TabPage1.SuspendLayout() Me.TabPage2.SuspendLayout() @@ -99,6 +100,7 @@ Partial Class sdgOneVarCompareModels ' 'TabPage1 ' + Me.TabPage1.Controls.Add(Me.ucrDisplayChiData) Me.TabPage1.Controls.Add(Me.ucrObjectName) Me.TabPage1.Controls.Add(Me.chkSaveObjects) Me.TabPage1.Controls.Add(Me.lblGoF) @@ -115,9 +117,9 @@ Partial Class sdgOneVarCompareModels 'ucrObjectName ' Me.ucrObjectName.IsReadOnly = False - Me.ucrObjectName.Location = New System.Drawing.Point(97, 27) + Me.ucrObjectName.Location = New System.Drawing.Point(129, 27) Me.ucrObjectName.Name = "ucrObjectName" - Me.ucrObjectName.Size = New System.Drawing.Size(107, 21) + Me.ucrObjectName.Size = New System.Drawing.Size(139, 21) Me.ucrObjectName.TabIndex = 5 ' 'TabPage2 @@ -182,6 +184,14 @@ Partial Class sdgOneVarCompareModels Me.chkDensity.Text = "Density" Me.chkDensity.UseVisualStyleBackColor = True ' + 'ucrDisplayChiData + ' + Me.ucrDisplayChiData.IsReadOnly = False + Me.ucrDisplayChiData.Location = New System.Drawing.Point(129, 51) + Me.ucrDisplayChiData.Name = "ucrDisplayChiData" + Me.ucrDisplayChiData.Size = New System.Drawing.Size(139, 21) + Me.ucrDisplayChiData.TabIndex = 6 + ' 'sdgOneVarCompareModels ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -217,4 +227,5 @@ Partial Class sdgOneVarCompareModels Friend WithEvents chkQQ As CheckBox Friend WithEvents ucrObjectName As ucrInputTextBox Friend WithEvents ucrSavePlots As ucrSaveGraph + Friend WithEvents ucrDisplayChiData As ucrInputTextBox End Class diff --git a/instat/sdgOneVarCompareModels.vb b/instat/sdgOneVarCompareModels.vb index 59b8187aea8..c7bb6ce59f0 100644 --- a/instat/sdgOneVarCompareModels.vb +++ b/instat/sdgOneVarCompareModels.vb @@ -16,13 +16,8 @@ Imports instat.Translations Public Class sdgOneVarCompareModels - Private clsRcdfcompFunction As New RFunction - Private clsRdenscompFunction As New RFunction - Private clsRqqcompFunction As New RFunction - Private clsRppcompFunction As New RFunction - Private clsListFunction As New RFunction - Private clsModel As New RFunction - Private clsRsyntax As New RFunction + Private clsRcdfcompFunction, clsRdenscompFunction, clsRqqcompFunction, clsRppcompFunction, clsListFunction, clsRAsDataFrame, clsModel, clsRsyntax, clsOperation As New RFunction + Private clsOperatorforTable, clsOperatorForBreaks As New ROperator Private WithEvents ucrRecs As ucrReceiver Public bfirstload As Boolean = True @@ -31,11 +26,11 @@ Public Class sdgOneVarCompareModels End Sub Public Sub InitialiseDialog() - clsRsyntax.AddParameter("chisqbreaks") clsRcdfcompFunction.SetRCommand("cdfcomp") clsRdenscompFunction.SetRCommand("denscomp") clsRqqcompFunction.SetRCommand("qqcomp") clsRppcompFunction.SetRCommand("ppcomp") + ucrDisplayChiData.SetValidationTypeAsRVariable() End Sub Public Sub SetDefaults() @@ -45,24 +40,46 @@ Public Class sdgOneVarCompareModels chkQQ.Checked = False chkSaveChi.Checked = True chkSaveObjects.Checked = True - chkInputBreakpoints.Enabled = False ' disabled for now ucrSavePlots.chkSaveGraph.Checked = False ucrSavePlots.Enabled = False ' disabled for now ucrSavePlots.ucrInputGraphName.SetPrefix("plots") ucrObjectName.SetValidationTypeAsRVariable() ucrObjectName.SetName("gof") - CreateGraphs() - ReturnEnabled() + ucrDisplayChiData.Reset() + ucrDisplayChiData.SetName(dlgOneVarCompareModels.ucrSelectorOneVarCompModels.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_ChiSquare") DisplayChiSquare() + DisplayChiBreaks() 'ucrBase.ihelptopicID = End Sub + Public Sub Reopen() + DisplayChiSquare() + End Sub + Public Sub SetModelFunction(clsNewModel As RFunction) clsModel = clsNewModel - clsRcdfcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) - clsRdenscompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) - clsRppcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) - clsRqqcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) + End Sub + + Public Sub DisplayChiSquare() + If chkSaveChi.Checked Then + ucrDisplayChiData.Visible = True + clsOperatorforTable.SetOperation("$") + clsOperatorforTable.SetParameter(True, clsRFunc:=clsModel) + clsOperatorforTable.SetParameter(False, strValue:="chisqtable") + clsRAsDataFrame.SetRCommand("as.data.frame") + clsRAsDataFrame.AddParameter("x", clsROperatorParameter:=clsOperatorforTable) + Else + ucrDisplayChiData.Visible = False + End If + If Not ucrDisplayChiData.IsEmpty Then + clsRAsDataFrame.SetAssignTo(ucrDisplayChiData.GetText(), strTempDataframe:=ucrDisplayChiData.GetText()) + Else + clsRAsDataFrame.RemoveAssignTo() + End If + End Sub + + Private Sub ucrDisplayChiData_NameChanged() Handles ucrDisplayChiData.NameChanged + DisplayChiSquare() End Sub Public Sub SetReceiver(ucrNewReceiver As ucrReceiver) @@ -75,82 +92,66 @@ Public Class sdgOneVarCompareModels Else ucrObjectName.Visible = True End If - ReturnEnabled() End Sub - Private Sub DisplayChiSquare() - 'If our distribution is continuous, then enable the option to display chi-square - 'For continuous this is always enabled. - End Sub Public Sub CreateGraphs() - If Not dlgOneVarCompareModels.UcrReceiver.IsEmpty Then - If chkCDF.Checked Then - frmMain.clsRLink.RunScript(clsRcdfcompFunction.ToScript(), 2) - End If - If chkPP.Checked Then - frmMain.clsRLink.RunScript(clsRppcompFunction.ToScript(), 2) - End If - If chkQQ.Checked Then - frmMain.clsRLink.RunScript(clsRqqcompFunction.ToScript(), 2) - End If - If chkDensity.Checked Then - frmMain.clsRLink.RunScript(clsRdenscompFunction.ToScript(), 2) - End If - End If + Dim strTemp As String = "" - 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 + If chkCDF.Checked Then + clsRcdfcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) + frmMain.clsRLink.RunScript(clsRcdfcompFunction.ToScript(), 2) + End If + If chkPP.Checked Then + clsRppcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) + frmMain.clsRLink.RunScript(clsRppcompFunction.ToScript(), 2) + End If + If chkQQ.Checked Then + clsRqqcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) + frmMain.clsRLink.RunScript(clsRqqcompFunction.ToScript(), 2) + End If + If chkDensity.Checked Then + clsRdenscompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) + frmMain.clsRLink.RunScript(clsRdenscompFunction.ToScript(), 2) + End If + If chkSaveChi.Checked Then + frmMain.clsRLink.RunScript(clsOperatorforTable.ToScript(), 0) + clsRAsDataFrame.ToScript(strTemp) + frmMain.clsRLink.RunScript(strTemp, 0) + End If If chkInputBreakpoints.Checked Then - clsRsyntax.AddParameter("chisqbreaks") 'in the brackets have numbers inputted numbers inputted + frmMain.clsRLink.RunScript(clsOperatorForBreaks.ToScript(), 2) End If End Sub - Private Sub ReturnEnabled() - If Not (chkSaveObjects.Checked AndAlso ucrObjectName.IsEmpty) Then - ucrSubBase.cmdReturn.Enabled = True - Else - ucrSubBase.cmdReturn.Enabled = False - End If + Private Sub chkInputBreakpoints_Checked_Changed(sender As Object, e As EventArgs) Handles chkInputBreakpoints.CheckedChanged + DisplayChiBreaks() End Sub - Public Sub ChiSqObject() - 'instat_object$set("public", "get_from_model", Function(data_name, model_name, chisqtable, value2, value3) - - dlgOneVarCompareModels.ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$get_from_model") - dlgOneVarCompareModels.ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & dlgOneVarCompareModels.ucrSelectorOneVarCompModels.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) - ' dlgOneVarCompareModels.ucrBase.clsRsyntax.AddParameter("model_name") Chr(34) & - + Public Sub DisplayChiBreaks() + If chkInputBreakpoints.Checked Then + clsOperatorForBreaks.SetOperation("$") + clsOperatorForBreaks.SetParameter(True, clsRFunc:=clsModel) + clsOperatorForBreaks.SetParameter(False, strValue:="chisqbreaks") + End If End Sub - Private Sub chkSaveChi_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveChi.CheckedChanged - 'dlgOneVarCompareModels.ucrBase.clsRsyntax. - - - 'display 5th element of object - the chisquare if this is selected. - ' for discrete this is shown anyway + DisplayChiSquare() End Sub ' Private Sub ucrSavePlots_NameChanged() Handles ucrSavePlots.Click '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 + bOkEnabled = True + Else + bOkEnabled = False + End If + Return bOkEnabled + End Function + End Class \ No newline at end of file diff --git a/instat/sdgOneVarFitModDisplay.Designer.vb b/instat/sdgOneVarFitModDisplay.Designer.vb index 4deb90f1897..9e9b192372e 100644 --- a/instat/sdgOneVarFitModDisplay.Designer.vb +++ b/instat/sdgOneVarFitModDisplay.Designer.vb @@ -23,27 +23,89 @@ Partial Class sdgOneVarFitModDisplay _ Private Sub InitializeComponent() Me.ucrBase = New instat.ucrButtonsSubdialogue() + Me.tbclikelihood = New System.Windows.Forms.TabPage() + Me.UcrSaveLikelihood = New instat.ucrSaveGraph() + Me.rdoNoLik = New System.Windows.Forms.RadioButton() + Me.rdoLik = New System.Windows.Forms.RadioButton() + Me.rdoLoglik = New System.Windows.Forms.RadioButton() Me.TabPage1 = New System.Windows.Forms.TabPage() - Me.rdoNoPlot = New System.Windows.Forms.RadioButton() - Me.rdoPlotAll = New System.Windows.Forms.RadioButton() - Me.rdoCDFPlot = New System.Windows.Forms.RadioButton() - Me.rdoDensityPlot = New System.Windows.Forms.RadioButton() - Me.rdoQQPlot = New System.Windows.Forms.RadioButton() + Me.ucrSavePlots = New instat.ucrSaveGraph() Me.rdoPPPlot = New System.Windows.Forms.RadioButton() + Me.rdoQQPlot = New System.Windows.Forms.RadioButton() + Me.rdoDensityPlot = New System.Windows.Forms.RadioButton() + Me.rdoCDFPlot = New System.Windows.Forms.RadioButton() + Me.rdoPlotAll = New System.Windows.Forms.RadioButton() + Me.rdoNoPlot = New System.Windows.Forms.RadioButton() Me.tbcPlots = New System.Windows.Forms.TabControl() + Me.tbclikelihood.SuspendLayout() Me.TabPage1.SuspendLayout() Me.tbcPlots.SuspendLayout() Me.SuspendLayout() ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(14, 219) + Me.ucrBase.Location = New System.Drawing.Point(12, 227) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(142, 30) Me.ucrBase.TabIndex = 1 ' + 'tbclikelihood + ' + Me.tbclikelihood.Controls.Add(Me.UcrSaveLikelihood) + Me.tbclikelihood.Controls.Add(Me.rdoNoLik) + Me.tbclikelihood.Controls.Add(Me.rdoLik) + Me.tbclikelihood.Controls.Add(Me.rdoLoglik) + Me.tbclikelihood.Location = New System.Drawing.Point(4, 22) + Me.tbclikelihood.Name = "tbclikelihood" + Me.tbclikelihood.Padding = New System.Windows.Forms.Padding(3) + Me.tbclikelihood.Size = New System.Drawing.Size(288, 185) + Me.tbclikelihood.TabIndex = 1 + Me.tbclikelihood.Text = "Likelihood" + Me.tbclikelihood.UseVisualStyleBackColor = True + ' + 'UcrSaveLikelihood + ' + Me.UcrSaveLikelihood.Location = New System.Drawing.Point(8, 158) + Me.UcrSaveLikelihood.Name = "UcrSaveLikelihood" + Me.UcrSaveLikelihood.Size = New System.Drawing.Size(265, 20) + Me.UcrSaveLikelihood.TabIndex = 3 + ' + 'rdoNoLik + ' + Me.rdoNoLik.AutoSize = True + Me.rdoNoLik.Location = New System.Drawing.Point(8, 66) + Me.rdoNoLik.Name = "rdoNoLik" + Me.rdoNoLik.Size = New System.Drawing.Size(60, 17) + Me.rdoNoLik.TabIndex = 2 + Me.rdoNoLik.TabStop = True + Me.rdoNoLik.Text = "No Plot" + Me.rdoNoLik.UseVisualStyleBackColor = True + ' + 'rdoLik + ' + Me.rdoLik.AutoSize = True + Me.rdoLik.Location = New System.Drawing.Point(8, 43) + Me.rdoLik.Name = "rdoLik" + Me.rdoLik.Size = New System.Drawing.Size(94, 17) + Me.rdoLik.TabIndex = 1 + Me.rdoLik.TabStop = True + Me.rdoLik.Text = "Plot Likelihood" + Me.rdoLik.UseVisualStyleBackColor = True + ' + 'rdoLoglik + ' + Me.rdoLoglik.AutoSize = True + Me.rdoLoglik.Location = New System.Drawing.Point(8, 20) + Me.rdoLoglik.Name = "rdoLoglik" + Me.rdoLoglik.Size = New System.Drawing.Size(115, 17) + Me.rdoLoglik.TabIndex = 0 + Me.rdoLoglik.TabStop = True + Me.rdoLoglik.Text = "Plot Log-Likelihood" + Me.rdoLoglik.UseVisualStyleBackColor = True + ' 'TabPage1 ' + Me.TabPage1.Controls.Add(Me.ucrSavePlots) Me.TabPage1.Controls.Add(Me.rdoPPPlot) Me.TabPage1.Controls.Add(Me.rdoQQPlot) Me.TabPage1.Controls.Add(Me.rdoDensityPlot) @@ -53,42 +115,37 @@ Partial Class sdgOneVarFitModDisplay Me.TabPage1.Location = New System.Drawing.Point(4, 22) Me.TabPage1.Name = "TabPage1" Me.TabPage1.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage1.Size = New System.Drawing.Size(153, 177) + Me.TabPage1.Size = New System.Drawing.Size(288, 185) Me.TabPage1.TabIndex = 0 Me.TabPage1.Text = "Plots" Me.TabPage1.UseVisualStyleBackColor = True ' - 'rdoNoPlot + 'ucrSavePlots ' - Me.rdoNoPlot.AutoSize = True - Me.rdoNoPlot.Checked = True - Me.rdoNoPlot.Location = New System.Drawing.Point(8, 20) - Me.rdoNoPlot.Name = "rdoNoPlot" - Me.rdoNoPlot.Size = New System.Drawing.Size(60, 17) - Me.rdoNoPlot.TabIndex = 0 - Me.rdoNoPlot.TabStop = True - Me.rdoNoPlot.Text = "No Plot" - Me.rdoNoPlot.UseVisualStyleBackColor = True + Me.ucrSavePlots.Location = New System.Drawing.Point(8, 158) + Me.ucrSavePlots.Name = "ucrSavePlots" + Me.ucrSavePlots.Size = New System.Drawing.Size(248, 20) + Me.ucrSavePlots.TabIndex = 4 ' - 'rdoPlotAll + 'rdoPPPlot ' - Me.rdoPlotAll.AutoSize = True - Me.rdoPlotAll.Location = New System.Drawing.Point(8, 43) - Me.rdoPlotAll.Name = "rdoPlotAll" - Me.rdoPlotAll.Size = New System.Drawing.Size(68, 17) - Me.rdoPlotAll.TabIndex = 1 - Me.rdoPlotAll.Text = "Multi-Plot" - Me.rdoPlotAll.UseVisualStyleBackColor = True + Me.rdoPPPlot.AutoSize = True + Me.rdoPPPlot.Location = New System.Drawing.Point(8, 135) + Me.rdoPPPlot.Name = "rdoPPPlot" + Me.rdoPPPlot.Size = New System.Drawing.Size(60, 17) + Me.rdoPPPlot.TabIndex = 5 + Me.rdoPPPlot.Text = "PP-Plot" + Me.rdoPPPlot.UseVisualStyleBackColor = True ' - 'rdoCDFPlot + 'rdoQQPlot ' - Me.rdoCDFPlot.AutoSize = True - Me.rdoCDFPlot.Location = New System.Drawing.Point(8, 66) - Me.rdoCDFPlot.Name = "rdoCDFPlot" - Me.rdoCDFPlot.Size = New System.Drawing.Size(67, 17) - Me.rdoCDFPlot.TabIndex = 2 - Me.rdoCDFPlot.Text = "CDF Plot" - Me.rdoCDFPlot.UseVisualStyleBackColor = True + Me.rdoQQPlot.AutoSize = True + Me.rdoQQPlot.Location = New System.Drawing.Point(8, 112) + Me.rdoQQPlot.Name = "rdoQQPlot" + Me.rdoQQPlot.Size = New System.Drawing.Size(62, 17) + Me.rdoQQPlot.TabIndex = 4 + Me.rdoQQPlot.Text = "QQ-Plot" + Me.rdoQQPlot.UseVisualStyleBackColor = True ' 'rdoDensityPlot ' @@ -100,47 +157,62 @@ Partial Class sdgOneVarFitModDisplay Me.rdoDensityPlot.Text = "Density Plot" Me.rdoDensityPlot.UseVisualStyleBackColor = True ' - 'rdoQQPlot + 'rdoCDFPlot ' - Me.rdoQQPlot.AutoSize = True - Me.rdoQQPlot.Location = New System.Drawing.Point(8, 112) - Me.rdoQQPlot.Name = "rdoQQPlot" - Me.rdoQQPlot.Size = New System.Drawing.Size(62, 17) - Me.rdoQQPlot.TabIndex = 4 - Me.rdoQQPlot.Text = "QQ-Plot" - Me.rdoQQPlot.UseVisualStyleBackColor = True + Me.rdoCDFPlot.AutoSize = True + Me.rdoCDFPlot.Location = New System.Drawing.Point(8, 66) + Me.rdoCDFPlot.Name = "rdoCDFPlot" + Me.rdoCDFPlot.Size = New System.Drawing.Size(67, 17) + Me.rdoCDFPlot.TabIndex = 2 + Me.rdoCDFPlot.Text = "CDF Plot" + Me.rdoCDFPlot.UseVisualStyleBackColor = True ' - 'rdoPPPlot + 'rdoPlotAll ' - Me.rdoPPPlot.AutoSize = True - Me.rdoPPPlot.Location = New System.Drawing.Point(8, 135) - Me.rdoPPPlot.Name = "rdoPPPlot" - Me.rdoPPPlot.Size = New System.Drawing.Size(60, 17) - Me.rdoPPPlot.TabIndex = 5 - Me.rdoPPPlot.Text = "PP-Plot" - Me.rdoPPPlot.UseVisualStyleBackColor = True + Me.rdoPlotAll.AutoSize = True + Me.rdoPlotAll.Location = New System.Drawing.Point(8, 43) + Me.rdoPlotAll.Name = "rdoPlotAll" + Me.rdoPlotAll.Size = New System.Drawing.Size(68, 17) + Me.rdoPlotAll.TabIndex = 1 + Me.rdoPlotAll.Text = "Multi-Plot" + Me.rdoPlotAll.UseVisualStyleBackColor = True + ' + 'rdoNoPlot + ' + Me.rdoNoPlot.AutoSize = True + Me.rdoNoPlot.Checked = True + Me.rdoNoPlot.Location = New System.Drawing.Point(8, 20) + Me.rdoNoPlot.Name = "rdoNoPlot" + Me.rdoNoPlot.Size = New System.Drawing.Size(60, 17) + Me.rdoNoPlot.TabIndex = 0 + Me.rdoNoPlot.TabStop = True + Me.rdoNoPlot.Text = "No Plot" + Me.rdoNoPlot.UseVisualStyleBackColor = True ' 'tbcPlots ' Me.tbcPlots.Controls.Add(Me.TabPage1) + Me.tbcPlots.Controls.Add(Me.tbclikelihood) Me.tbcPlots.Location = New System.Drawing.Point(10, 10) Me.tbcPlots.Name = "tbcPlots" Me.tbcPlots.SelectedIndex = 0 - Me.tbcPlots.Size = New System.Drawing.Size(161, 203) + Me.tbcPlots.Size = New System.Drawing.Size(296, 211) Me.tbcPlots.TabIndex = 0 ' 'sdgOneVarFitModDisplay ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(176, 256) - Me.Controls.Add(Me.ucrBase) + Me.ClientSize = New System.Drawing.Size(311, 263) Me.Controls.Add(Me.tbcPlots) + Me.Controls.Add(Me.ucrBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "sdgOneVarFitModDisplay" Me.Text = "Display Options" + Me.tbclikelihood.ResumeLayout(False) + Me.tbclikelihood.PerformLayout() Me.TabPage1.ResumeLayout(False) Me.TabPage1.PerformLayout() Me.tbcPlots.ResumeLayout(False) @@ -148,6 +220,10 @@ Partial Class sdgOneVarFitModDisplay End Sub Friend WithEvents ucrBase As ucrButtonsSubdialogue + Friend WithEvents tbclikelihood As TabPage + Friend WithEvents rdoNoLik As RadioButton + Friend WithEvents rdoLik As RadioButton + Friend WithEvents rdoLoglik As RadioButton Friend WithEvents TabPage1 As TabPage Friend WithEvents rdoPPPlot As RadioButton Friend WithEvents rdoQQPlot As RadioButton @@ -156,4 +232,6 @@ Partial Class sdgOneVarFitModDisplay Friend WithEvents rdoPlotAll As RadioButton Friend WithEvents rdoNoPlot As RadioButton Friend WithEvents tbcPlots As TabControl + Friend WithEvents ucrSavePlots As ucrSaveGraph + Friend WithEvents UcrSaveLikelihood As ucrSaveGraph End Class diff --git a/instat/sdgOneVarFitModDisplay.vb b/instat/sdgOneVarFitModDisplay.vb index d09945d47f0..5de11a7859d 100644 --- a/instat/sdgOneVarFitModDisplay.vb +++ b/instat/sdgOneVarFitModDisplay.vb @@ -18,7 +18,9 @@ Imports instat.Translations Public Class sdgOneVarFitModDisplay Private clsRplotFunction As New RFunction Private clsModel As New RFunction + Private clsRLogLikFunction As New RFunction Private WithEvents ucrDists As ucrDistributions + Public clsRdataframe As ucrDataFrame Public bfirstload As Boolean = True Private Sub sdgOneVarFitModDisplay(sender As Object, e As EventArgs) Handles MyBase.Load @@ -26,15 +28,25 @@ Public Class sdgOneVarFitModDisplay End Sub Public Sub InitialiseDialog() + UcrSaveLikelihood.SetDataFrameSelector(dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames) + UcrSaveLikelihood.strPrefix = "Likelihood" + ucrSavePlots.SetDataFrameSelector(dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames) + ucrSavePlots.strPrefix = "Plot" + clsRLogLikFunction.SetRCommand("llplot") End Sub Public Sub SetDefaults() rdoPlotAll.Checked = True + rdoLoglik.Checked = True + 'ucrSaveLikelihood.Enabled = False 'ucrBase.ihelptopicID = + UcrSaveLikelihood.Reset() + ucrSavePlots.Reset() End Sub Public Sub SetModelFunction(clsNewModel As RFunction) clsModel = clsNewModel + clsRLogLikFunction.AddParameter("mlefit", clsRFunctionParameter:=clsModel) End Sub Public Sub SetDistribution(ucrNewDists As ucrDistributions) @@ -44,22 +56,27 @@ Public Class sdgOneVarFitModDisplay Public Sub CreateGraphs() If rdoPlotAll.Checked Then + clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("plot") clsRplotFunction.AddParameter("x", clsRFunctionParameter:=clsModel) frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoPPPlot.Checked Then + clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("ppcomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoCDFPlot.Checked Then + clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("cdfcomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoQQPlot.Checked Then + clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("qqcomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoDensityPlot.Checked Then + clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("denscomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) @@ -85,4 +102,58 @@ Public Class sdgOneVarFitModDisplay End If End Sub + ' looking into tab2 + + Public Sub rdoLikelihoods_CheckedChanged(sender As Object, e As EventArgs) Handles rdoLoglik.CheckedChanged, rdoLik.CheckedChanged + If rdoLoglik.Checked Then + clsRLogLikFunction.AddParameter("loglik", strParameterValue:="TRUE") + ElseIf rdoLik.Checked Then + clsRLogLikFunction.AddParameter("loglik", strParameterValue:="FALSE") + End If + End Sub + + Public Sub RunLikelihoods() + frmMain.clsRLink.RunScript(clsRLogLikFunction.ToScript(), 2) + End Sub + + + Private Sub UcrSaveLikelihood_GraphNameChanged() Handles UcrSaveLikelihood.GraphNameChanged, UcrSaveLikelihood.SaveGraphCheckedChanged + If UcrSaveLikelihood.bSaveGraph Then + dlgOneVarFitModel.UcrBase.clsRsyntax.SetAssignTo(UcrSaveLikelihood.strGraphName, strTempDataframe:=dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=UcrSaveLikelihood.strGraphName) + Else + dlgOneVarFitModel.UcrBase.clsRsyntax.RemoveAssignTo() + End If + End Sub + + Private Sub ucrSavePlots_GraphNameChanged() Handles ucrSavePlots.GraphNameChanged, ucrSavePlots.SaveGraphCheckedChanged + If ucrSavePlots.bSaveGraph Then + dlgOneVarFitModel.UcrBase.clsRsyntax.SetAssignTo(ucrSavePlots.strGraphName, strTempDataframe:=dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrSavePlots.strGraphName) + Else + dlgOneVarFitModel.UcrBase.clsRsyntax.RemoveAssignTo() + End If + End Sub + + Private Sub VisibleSaveGraph_CheckedChanged(sender As Object, e As EventArgs) Handles rdoNoPlot.CheckedChanged, rdoNoLik.CheckedChanged + If rdoNoPlot.Checked Then + ucrSavePlots.Visible = False + Else + ucrSavePlots.Visible = True + End If + If rdoNoLik.Checked Then + UcrSaveLikelihood.Visible = False + Else + UcrSaveLikelihood.Visible = True + End If + End Sub + + Public Function TestOkEnabled() As Boolean + Dim bOkEnabled As Boolean + If (ucrSavePlots.chkSaveGraph.Checked AndAlso Not ucrSavePlots.ucrInputGraphName.IsEmpty OrElse Not ucrSavePlots.chkSaveGraph.Checked) AndAlso (UcrSaveLikelihood.chkSaveGraph.Checked AndAlso Not UcrSaveLikelihood.ucrInputGraphName.IsEmpty OrElse Not UcrSaveLikelihood.chkSaveGraph.Checked) Then + bOkEnabled = True + Else + bOkEnabled = False + End If + Return bOkEnabled + End Function + End Class \ No newline at end of file diff --git a/instat/sdgOneVarFitModel.vb b/instat/sdgOneVarFitModel.vb index ecb561f7d1a..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 @@ -67,7 +57,7 @@ Public Class sdgOneVarFitModel End Sub - Private Sub rdoEstimators_CheckedChanged(sender As Object, e As EventArgs) Handles rdoMle.CheckedChanged, rdoMme.CheckedChanged, rdoQme.CheckedChanged, rdoMge.CheckedChanged + Public Sub rdoEstimators_CheckedChanged(sender As Object, e As EventArgs) Handles rdoMle.CheckedChanged, rdoMme.CheckedChanged, rdoQme.CheckedChanged, rdoMge.CheckedChanged If rdoMle.Checked Then clsRSyntax.AddParameter("method", Chr(34) & "mle" & Chr(34)) ElseIf rdoMme.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 392a7585b45..2f692749381 100644 --- a/instat/sdgOneVarUseModFit.vb +++ b/instat/sdgOneVarUseModFit.vb @@ -17,11 +17,6 @@ Imports instat.Translations Public Class sdgOneVarUseModFit Private clsRplotFunction As New RFunction - Private clsRppFunction As New RFunction - Private clsRqqFunction As New RFunction - Private clsRdensFunction As New RFunction - Private clsRcdfFunction As New RFunction - Private clsRCIcdfFunction As New RFunction Public clsRbootFunction As New RFunction Private clsRseqFunction As New RFunction Private clsModel As New RFunction @@ -33,12 +28,6 @@ Public Class sdgOneVarUseModFit End Sub Public Sub InitialiseDialog() - clsRplotFunction.SetRCommand("plot") - clsRcdfFunction.SetRCommand("cdfcomp") - clsRppFunction.SetRCommand("ppcomp") - clsRdensFunction.SetRCommand("denscomp") - clsRqqFunction.SetRCommand("qqcomp") - clsRCIcdfFunction.SetRCommand("CIcdfplot") nudFrom.Minimum = 0 nudFrom.Maximum = 1 nudFrom.Increment = 0.05 @@ -54,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 @@ -68,26 +55,32 @@ Public Class sdgOneVarUseModFit Public Sub CreateGraphs() If rdoPlotAll.Checked Then + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("plot") clsRplotFunction.AddParameter("x", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) - frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoPPPlot.Checked Then - clsRppFunction.SetRCommand("ppcomp") - clsRppFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) - frmMain.clsRLink.RunScript(clsRppFunction.ToScript(), 2) + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("ppcomp") + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoCDFPlot.Checked Then - clsRcdfFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) - frmMain.clsRLink.RunScript(clsRcdfFunction.ToScript(), 2) + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("cdfcomp") + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoQQPlot.Checked Then - clsRqqFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) - frmMain.clsRLink.RunScript(clsRqqFunction.ToScript(), 2) + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("qqcomp") + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoDensityPlot.Checked Then - clsRdensFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) - frmMain.clsRLink.RunScript(clsRdensFunction.ToScript(), 2) + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("denscomp") + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoCIcdf.Checked Then - clsRCIcdfFunction.AddParameter("b", clsRFunctionParameter:=clsRbootFunction) - clsRCIcdfFunction.AddParameter("CI.output", Chr(34) & "quantile" & Chr(34)) - frmMain.clsRLink.RunScript(clsRCIcdfFunction.ToScript(), 2) + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("CIcdfplot") + clsRplotFunction.AddParameter("b", clsRFunctionParameter:=clsRbootFunction) + clsRplotFunction.AddParameter("CI.output", Chr(34) & "quantile" & Chr(34)) End If + frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) End Sub Public Sub SetMyBootFunction(clsRNewBoot As RFunction) @@ -115,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 diff --git a/instat/static/InstatObject/R/Backend_Components/link.R b/instat/static/InstatObject/R/Backend_Components/link.R index e8a49ba2670..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) } @@ -71,4 +69,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 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 diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index 9bb72ca16ed..348a3567174 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -1608,4 +1608,12 @@ data_object$set("public","make_date_yeardoy", function(year, doy, year_format = #TODO this will be more complex to make into account of doy_typical_length return(as.Date(paste(year_col, doy_col), format = paste(year_format, doy_format))) } +) + +data_object$set("public","set_contrasts_of_factor", function(factor, new_contrasts) { + if(!factor %in% names(self$get_data_frame())) stop(factor, " not found in the data") + if(!is.factor(self$get_columns_from_data(factor))) stop(factor, " is not a factor column.") + #checks needed on contrasts before assigning + contrasts(private$data[[factor]]) <- new_contrasts +} ) \ No newline at end of file diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index eb8edea7f91..13236d7d2cf 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -947,4 +947,50 @@ instat_object$set("public","make_date_yearmonthday", function(data_name, year, m instat_object$set("public","make_date_yeardoy", function(data_name, year, doy, year_format = "%Y", doy_format = "%j", doy_typical_length = "366") { self$get_data_objects(data_name)$make_date_yeardoy(year = year, doy = doy, year_format = year_format, doy_format = doy_format, doy_typical_length = doy_typical_length) } +) + +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 diff --git a/instat/ucrButtons.vb b/instat/ucrButtons.vb index ffb260a1e0e..ebdc5e537ea 100644 --- a/instat/ucrButtons.vb +++ b/instat/ucrButtons.vb @@ -58,8 +58,8 @@ Public Class ucrButtons For Each ctrTempControl In ParentForm.Controls lstCurrentEnabled.Add(ctrTempControl.Enabled) ctrTempControl.Enabled = False - Next - ParentForm.Cursor = Cursors.WaitCursor + Next + ParentForm.Cursor = Cursors.WaitCursor RaiseEvent BeforeClickOk(sender, e) @@ -92,8 +92,8 @@ Public Class ucrButtons For Each ctrTempControl In ParentForm.Controls ctrTempControl.Enabled = lstCurrentEnabled(i) i = i + 1 - Next - ParentForm.Cursor = Cursors.Default + Next + ParentForm.Cursor = Cursors.Default End Sub @@ -130,7 +130,10 @@ Public Class ucrButtons End Sub Private Sub cmdHelp_Click(sender As Object, e As EventArgs) Handles cmdHelp.Click + HelpContent() + End Sub + Private Sub HelpContent() ' (1) Use HelpNDoc's Help Context number. Not dependent on HelpNDoc. If iHelpTopicID > 0 Then Help.ShowHelp(Me.Parent, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TopicId, iHelpTopicID.ToString()) @@ -145,7 +148,6 @@ Public Class ucrButtons ' covertion from .bas) to refer to the Help Context numbers. 'Help.ShowHelp(Me, strHelpFilePath, HelpNavigator.TopicId, mHelpConstants.HELP_Maths.ToString) End Sub - Private Sub chkComment_KeyPress(sender As Object, e As KeyPressEventArgs) Handles chkComment.KeyPress If e.KeyChar = vbCr And chkComment.Checked = True Then chkComment.Checked = False 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) diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index 1e70bbaceea..8c01bc5b29c 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -144,6 +144,9 @@ Public Class ucrGeom ''geom_hline:yintercept ''geom_abline: slope and intercept ''TO DO Discuss how to use these + ''add layer parameters + 'clsgeom_abline.AddLayerParameter("intercept", "numeric", "0") + 'clsgeom_abline.AddLayerParameter("xxxxxxxx", "numeric", "0") 'lstAllGeoms.Add(clsgeom_abline) 'clsgeom_area.SetGeomName("geom_area") @@ -157,6 +160,11 @@ Public Class ucrGeom 'clsgeom_area.AddAesParameter("fill") 'clsgeom_area.AddAesParameter("linetype") 'clsgeom_area.AddAesParameter("size") + + ''add layer parameters + 'clsgeom_area.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_area.AddLayerParameter("position", "list", Chr(34) & "stack" & Chr(34)) + 'clsgeom_area.AddLayerParameter("na.rm", "boolean", "FALSE") 'lstAllGeoms.Add(clsgeom_area) clsgeom_bar.SetGeomName("geom_bar") @@ -183,6 +191,13 @@ Public Class ucrGeom 'clsgeom_bin2d.AddAesParameter("y", bIsMandatory:=True) ''optional 'clsgeom_bin2d.AddAesParameter("fill") + ''adding layer parameters + 'clsgeom_bin2d.AddLayerParameter("stat", "list", Chr(34) & "bin2d" & Chr(34)) + 'clsgeom_bin2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_bin2d.AddLayerParameter("na.rm", "boolean", "FALSE") + 'clsgeom_bin2d.AddLayerParameter("bins", "numeric", "30") + 'clsgeom_bin2d.AddLayerParameter("binwidth", "numeric", "0.1") + 'lstAllGeoms.Add(clsgeom_bin2d) @@ -216,6 +231,15 @@ Public Class ucrGeom 'clsgeom_contour.AddAesParameter("linetype") 'clsgeom_contour.AddAesParameter("size") 'clsgeom_contour.AddAesParameter("weight") + + ''add layer parameters + 'clsgeom_contour.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + 'clsgeom_contour.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_contour.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_contour.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_contour.AddLayerParameter("linemitre", "numeric", "1") + ''bin and binwidth could be added here as well. I am not sure if they are needed.... 'lstAllGeoms.Add(clsgeom_contour) 'clsgeom_count.SetGeomName("geom_count") @@ -229,6 +253,10 @@ Public Class ucrGeom 'clsgeom_count.AddAesParameter("shape") 'clsgeom_count.AddAesParameter("size") 'clsgeom_count.AddAesParameter("stroke") + + ''adding layer parameters + 'clsgeom_count.AddLayerParameter("stat", "list", Chr(34) & "sum" & Chr(34)) + 'clsgeom_count.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_count) 'clsgeom_crossbar.strGeomName = "geom_crossbar" @@ -241,6 +269,10 @@ Public Class ucrGeom 'clsgeom_crossbar.AddAesParameter("colour") 'clsgeom_crossbar.AddAesParameter("linetype") 'clsgeom_crossbar.AddAesParameter("size") + + ''adding layer parameters + 'clsgeom_crossbar.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_crossbar.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_crossbar) 'clsgeom_curve.strGeomName = "geom_curve" @@ -249,11 +281,19 @@ Public Class ucrGeom 'clsgeom_curve.AddAesParameter("xend", bIsMandatory:=True) 'clsgeom_curve.AddAesParameter("y", bIsMandatory:=True) 'clsgeom_curve.AddAesParameter("yend", bIsMandatory:=True) - 'Optional + ''Optional 'clsgeom_curve.AddAesParameter("alpha") 'clsgeom_curve.AddAesParameter("colour") 'clsgeom_curve.AddAesParameter("linetype") 'clsgeom_curve.AddAesParameter("size") + + ''adding layer parameters + 'clsgeom_curve.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_curve.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_curve.AddLayerParameter("curvature", "numeric", "0.5") 'numeric values. negative values give a left hand curve while positive values give right hand curves + 'clsgeom_curve.AddLayerParameter("angle", "numeric", "90") 'needs to be 0-180 + 'clsgeom_curve.AddLayerParameter("ncp", "numeric", "5") 'more control point creates a smoother curve + 'clsgeom_curve.AddLayerParameter("lineend", "list", "butt", lstParameterStrings:={Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) 'lstAllGeoms.Add(clsgeom_curve) clsgeom_density.strGeomName = "geom_density" @@ -286,6 +326,14 @@ Public Class ucrGeom 'clsgeom_density2d.AddAesParameter("colour") 'clsgeom_density2d.AddAesParameter("linetype") 'clsgeom_density2d.AddAesParameter("size") + + ''Adding layer parameters + 'clsgeom_density2d.AddLayerParameter("stat", "list", Chr(34) & "density2d" & Chr(34)) + 'clsgeom_density2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_density2d.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_density2d.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_density2d.AddLayerParameter("linemitre", "numeric", "1") 'lstAllGeoms.Add(clsgeom_density2d) 'clsgeom_density_2d.strGeomName = "geom_density_2d" @@ -297,6 +345,14 @@ Public Class ucrGeom 'clsgeom_density_2d.AddAesParameter("colour") 'clsgeom_density_2d.AddAesParameter("linetype") 'clsgeom_density_2d.AddAesParameter("size") + + ''Adding layer parameters + 'clsgeom_density_2d.AddLayerParameter("stat", "list", Chr(34) & "density2d" & Chr(34)) + 'clsgeom_density_2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_density_2d.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_density_2d.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_density2d.AddLayerParameter("linemitre", "numeric", "1") 'lstAllGeoms.Add(clsgeom_density_2d) clsgeom_dotplot.strGeomName = "geom_dotplot" @@ -306,7 +362,6 @@ Public Class ucrGeom clsgeom_dotplot.AddAesParameter("alpha", strIncludedDataTypes:={"factor"}) clsgeom_dotplot.AddAesParameter("colour", strIncludedDataTypes:={"factor"}) clsgeom_dotplot.AddAesParameter("fill", strIncludedDataTypes:={"factor"}) - 'adding layer parameters clsgeom_dotplot.AddLayerParameter("method", "list", Chr(34) & "dotdensity" & Chr(34), lstParameterStrings:={Chr(34) & "dotdensity" & Chr(34), Chr(34) & "histodot" & Chr(34)}) clsgeom_dotplot.AddLayerParameter("binwidth", "numeric", "1", lstParameterStrings:={1, 1}) @@ -323,18 +378,21 @@ Public Class ucrGeom lstAllGeoms.Add(clsgeom_dotplot) - clsgeom_errorbar.strGeomName = "geom_errorbar" - ''Mandatory - clsgeom_errorbar.AddAesParameter("x", bIsMandatory:=True) - clsgeom_errorbar.AddAesParameter("ymax", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) - clsgeom_errorbar.AddAesParameter("ymin", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) - ''Optional - clsgeom_errorbar.AddAesParameter("alpha", strIncludedDataTypes:={"factor"}) - clsgeom_errorbar.AddAesParameter("colour", strIncludedDataTypes:={"factor"}) - clsgeom_errorbar.AddAesParameter("linetype", strIncludedDataTypes:={"factor"}) - clsgeom_errorbar.AddAesParameter("size", strIncludedDataTypes:={"factor"}) - clsgeom_errorbar.AddAesParameter("width", strIncludedDataTypes:={"numeric"}) - lstAllGeoms.Add(clsgeom_errorbar) + 'clsgeom_errorbar.strGeomName = "geom_errorbar" + '''Mandatory + 'clsgeom_errorbar.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_errorbar.AddAesParameter("ymax", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) + 'clsgeom_errorbar.AddAesParameter("ymin", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) + '''Optional + 'clsgeom_errorbar.AddAesParameter("alpha", strIncludedDataTypes:={"factor"}) + 'clsgeom_errorbar.AddAesParameter("colour", strIncludedDataTypes:={"factor"}) + 'clsgeom_errorbar.AddAesParameter("linetype", strIncludedDataTypes:={"factor"}) + 'clsgeom_errorbar.AddAesParameter("size", strIncludedDataTypes:={"factor"}) + 'clsgeom_errorbar.AddAesParameter("width", strIncludedDataTypes:={"numeric"}) + ''adding layer parameters + 'clsgeom_errorbar.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_errorbar.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_errorbar) 'clsgeom_errorbarh.strGeomName = "geom_errorbarh" ''mandatory @@ -348,7 +406,11 @@ Public Class ucrGeom 'clsgeom_errorbarh.AddAesParameter("height") 'clsgeom_errorbarh.AddAesParameter("linetype") 'clsgeom_errorbarh.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_errorbarh) + + 'add layer parameters + clsgeom_errorbarh.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_errorbarh.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_errorbarh) clsgeom_freqpoly.strGeomName = "geom_freqpoly" clsgeom_freqpoly.AddAesParameter("x", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) @@ -373,6 +435,10 @@ Public Class ucrGeom 'clsgeom_hex.AddAesParameter("colour") 'clsgeom_hex.AddAesParameter("fill") 'clsgeom_hex.AddAesParameter("size") + + ''add layer parameter + 'clsgeom_hex.AddLayerParameter("stat", "list", Chr(34) & "binhex" & Chr(34)) + 'clsgeom_hex.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_hex) clsgeom_histogram.strGeomName = "geom_histogram" @@ -402,6 +468,8 @@ Public Class ucrGeom ''geom_hline:yintercept ''geom_abline: slope and intercept ''TO DO Discuss how to use these + ''add layer parameter + 'clsgeom_hline.AddLayerParameter("yintercept", "numeric", "0") 'lstAllGeoms.Add(clsgeom_hline) 'clsgeom_jitter.strGeomName = "geom_jitter" @@ -415,6 +483,10 @@ Public Class ucrGeom 'clsgeom_jitter.AddAesParameter("shape") 'clsgeom_jitter.AddAesParameter("size") 'clsgeom_jitter.AddAesParameter("stroke") + + ''add layer parameter + 'clsgeom_jitter.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_jitter.AddLayerParameter("position", "list", Chr(34) & "jitter" & Chr(34)) 'lstAllGeoms.Add(clsgeom_jitter) 'clsgeom_label.strGeomName = "geom_label" @@ -442,8 +514,8 @@ Public Class ucrGeom clsgeom_line.AddAesParameter("colour", strIncludedDataTypes:={"numeric", "factor"}) clsgeom_line.AddAesParameter("linetype", strIncludedDataTypes:={"factor"}) clsgeom_line.AddAesParameter("size", strIncludedDataTypes:={"numeric, factor"}) - 'adding layer parameters + 'adding layer parameters clsgeom_line.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34), lstParameterStrings:={Chr(34) & "identity" & Chr(34), Chr(34) & "jitter" & Chr(34), Chr(34) & "dodge" & Chr(34), Chr(34) & "stack" & Chr(34)}) 'others options are “jitter”, “dodge” And “stack” lstAllGeoms.Add(clsgeom_line) @@ -458,6 +530,10 @@ Public Class ucrGeom 'clsgeom_linerange.AddAesParameter("colour") 'clsgeom_linerange.AddAesParameter("linetype") 'clsgeom_linerange.AddAesParameter("size") + + ''adding layer parameters + 'clsgeom_linerange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_linerange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_linerange) 'clsgeom_map.strGeomName = "geom_map" @@ -469,6 +545,9 @@ Public Class ucrGeom 'clsgeom_map.AddAesParameter("fill") 'clsgeom_map.AddAesParameter("linetype") 'clsgeom_map.AddAesParameter("size") + + ''adding layer parameters + 'clsgeom_map.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_map) 'clsgeom_path.strGeomName = "geom_path" @@ -480,6 +559,13 @@ Public Class ucrGeom 'clsgeom_path.AddAesParameter("colour") 'clsgeom_path.AddAesParameter("linetype") 'clsgeom_path.AddAesParameter("size") + ''add layer parameters + 'clsgeom_path.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + 'clsgeom_path.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_path.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_path.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_path.AddLayerParameter("linemitre", "numeric", "1") 'lstAllGeoms.Add(clsgeom_path) clsgeom_point.strGeomName = "geom_point" @@ -506,6 +592,10 @@ Public Class ucrGeom 'clsgeom_pointrange.AddAesParameter("colour") 'clsgeom_pointrange.AddAesParameter("linetype") 'clsgeom_pointrange.AddAesParameter("size") + ''adding layer parameters + 'clsgeom_pointrange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_pointrange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_pointrange) 'clsgeom_polygon.strGeomName = "geom_polygon" @@ -517,14 +607,17 @@ Public Class ucrGeom 'clsgeom_polygon.AddAesParameter("fill") 'clsgeom_polygon.AddAesParameter("linetype") 'clsgeom_polygon.AddAesParameter("size") + ''add layer parameters + 'clsgeom_polygon.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_polygon.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_polygon) - 'clsgeom_qq.strGeomName = "geom_qq" - 'clsgeom_qq.AddAesParameter("sample", bIsMandatory:=True) - ''optional - 'clsgeom_qq.AddAesParameter("x") - 'clsgeom_qq.AddAesParameter("y") - 'lstAllGeoms.Add(clsgeom_qq) + ''clsgeom_qq.strGeomName = "geom_qq" + ''clsgeom_qq.AddAesParameter("sample", bIsMandatory:=True) + '''optional + ''clsgeom_qq.AddAesParameter("x") + ''clsgeom_qq.AddAesParameter("y") + ''lstAllGeoms.Add(clsgeom_qq) 'clsgeom_quantile.strGeomName = "geom_quantile" 'clsgeom_quantile.AddAesParameter("x", bIsMandatory:=True) @@ -535,6 +628,14 @@ Public Class ucrGeom 'clsgeom_quantile.AddAesParameter("linetype") 'clsgeom_quantile.AddAesParameter("size") 'clsgeom_quantile.AddAesParameter("weight") + + ''adding layer parameter + 'clsgeom_quantile.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + 'clsgeom_quantile.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_quantile.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_quantile.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_quantile.AddLayerParameter("linemitre", "numeric", "1") 'lstAllGeoms.Add(clsgeom_quantile) 'clsgeom_raster.strGeomName = "geom_raster" @@ -547,6 +648,13 @@ Public Class ucrGeom 'clsgeom_raster.AddAesParameter("fill") 'clsgeom_raster.AddAesParameter("linetype") 'clsgeom_raster.AddAesParameter("size") + + ''add layer parameter + 'clsgeom_raster.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_raster.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_raster.AddLayerParameter("hjust", "numeric", "0.5") + 'clsgeom_raster.AddLayerParameter("vjust", "numeric", "0.5") + 'lstAllGeoms.Add(clsgeom_raster) 'clsgeom_rect.strGeomName = "geom_rect" @@ -559,6 +667,10 @@ Public Class ucrGeom 'clsgeom_rect.AddAesParameter("fill") 'clsgeom_rect.AddAesParameter("linetype") 'clsgeom_rect.AddAesParameter("size") + + ''clsgeom_raster.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_rect.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_rect.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_rect) 'clsgeom_ribbon.strGeomName = "geom_ribbon" @@ -570,6 +682,10 @@ Public Class ucrGeom 'clsgeom_ribbon.AddAesParameter("colour") 'clsgeom_ribbon.AddAesParameter("linetype") 'clsgeom_ribbon.AddAesParameter("size") + + ''add layer parameter + 'clsgeom_ribbon.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_ribbon.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_ribbon) 'clsgeom_rug.strGeomName = "geom_rug" @@ -577,6 +693,10 @@ Public Class ucrGeom 'clsgeom_rug.AddAesParameter("colour") 'clsgeom_rug.AddAesParameter("linetype") 'clsgeom_rug.AddAesParameter("size") + + ''adding layer parameters + 'clsgeom_rug.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_rug.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_rug) 'clsgeom_segment.strGeomName = "geom_segment" @@ -590,20 +710,25 @@ Public Class ucrGeom 'clsgeom_segment.AddAesParameter("colour") 'clsgeom_segment.AddAesParameter("linetype") 'clsgeom_segment.AddAesParameter("size") + ''add layer parameter + 'clsgeom_segment.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_segment.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_segment.AddLayerParameter("hjust", "numeric", "0.5") + 'clsgeom_segment.AddLayerParameter("vjust", "numeric", "0.5") 'lstAllGeoms.Add(clsgeom_segment) - 'clsgeom_smooth.strGeomName = "geom_smooth" - ''mandatory - 'clsgeom_smooth.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_smooth.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_smooth.AddAesParameter("alpha") - 'clsgeom_smooth.AddAesParameter("colour") - 'clsgeom_smooth.AddAesParameter("fill") - 'clsgeom_smooth.AddAesParameter("linetype") - 'clsgeom_smooth.AddAesParameter("size") - 'clsgeom_smooth.AddAesParameter("weight") - 'lstAllGeoms.Add(clsgeom_smooth) + ''clsgeom_smooth.strGeomName = "geom_smooth" + '''mandatory + ''clsgeom_smooth.AddAesParameter("x", bIsMandatory:=True) + ''clsgeom_smooth.AddAesParameter("y", bIsMandatory:=True) + '''optional + ''clsgeom_smooth.AddAesParameter("alpha") + ''clsgeom_smooth.AddAesParameter("colour") + ''clsgeom_smooth.AddAesParameter("fill") + ''clsgeom_smooth.AddAesParameter("linetype") + ''clsgeom_smooth.AddAesParameter("size") + ''clsgeom_smooth.AddAesParameter("weight") + ''lstAllGeoms.Add(clsgeom_smooth) 'clsgeom_spoke.strGeomName = "geom_spoke" ''mandatory @@ -616,6 +741,10 @@ Public Class ucrGeom 'clsgeom_spoke.AddAesParameter("colour") 'clsgeom_spoke.AddAesParameter("linetype") 'clsgeom_spoke.AddAesParameter("size") + + ''add layer parameter + 'clsgeom_spoke.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_spoke.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_spoke) 'clsgeom_step.strGeomName = "geom_step" @@ -626,6 +755,14 @@ Public Class ucrGeom 'clsgeom_step.AddAesParameter("colour") 'clsgeom_step.AddAesParameter("linetype") 'clsgeom_step.AddAesParameter("size") + + ''adding layer parameter + 'clsgeom_step.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + 'clsgeom_step.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_step.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_step.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_step.AddLayerParameter("linemitre", "numeric", "1") 'lstAllGeoms.Add(clsgeom_step) 'clsgeom_text.strGeomName = "geom_text" @@ -640,7 +777,16 @@ Public Class ucrGeom 'clsgeom_text.AddAesParameter("fontface") 'clsgeom_text.AddAesParameter("hjust") 'clsgeom_text.AddAesParameter("lineheight") - ''TO DO add size and vjust this might need additon of labels and receivers + ''TO DO add size and vjust this might need additon of labels and receivers + + + ''adding layer parameters + 'clsgeom_text.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_text.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_text.AddLayerParameter("parse", "bolean", "FALSE") + 'clsgeom_text.AddLayerParameter("nudge_x", "numeric", "0") + 'clsgeom_text.AddLayerParameter("nudge_y", "numeric", "0") + 'clsgeom_text.AddLayerParameter("check_overlap", "bolean", "FALSE") 'lstAllGeoms.Add(clsgeom_text) 'clsgeom_tile.strGeomName = "geom_tile" @@ -653,6 +799,10 @@ Public Class ucrGeom 'clsgeom_tile.AddAesParameter("fill") 'clsgeom_tile.AddAesParameter("linetype") 'clsgeom_tile.AddAesParameter("size") + + ''add layer parameters + 'clsgeom_tile.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_tile.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_tile) 'clsgeom_violin.strGeomName = "geom_violin" @@ -666,6 +816,9 @@ Public Class ucrGeom 'clsgeom_violin.AddAesParameter("linetype") 'clsgeom_violin.AddAesParameter("size") 'clsgeom_violin.AddAesParameter("weight") + ''add layer parameter + 'clsgeom_violin.AddLayerParameter("stat", "list", Chr(34) & "ydensity" & Chr(34)) + 'clsgeom_violin.AddLayerParameter("position", "list", Chr(34) & "dodge" & Chr(34)) 'lstAllGeoms.Add(clsgeom_violin) 'clsgeom_vline.strGeomName = "geom_vline" @@ -674,6 +827,8 @@ Public Class ucrGeom 'clsgeom_vline.AddAesParameter("linetype") 'clsgeom_vline.AddAesParameter("size") ''TO DO include those that control position + ''add layer parameter + 'clsgeom_vline.AddLayerParameter("xintercept", "numeric", "0") 'lstAllGeoms.Add(clsgeom_vline) End Sub Public Event GeomChanged(sender As Object, e As EventArgs)