diff --git a/instat/dlgDescribeTwoVarGraph.Designer.vb b/instat/dlgDescribeTwoVarGraph.Designer.vb index 225ff9ef375..52f29d1fcb5 100644 --- a/instat/dlgDescribeTwoVarGraph.Designer.vb +++ b/instat/dlgDescribeTwoVarGraph.Designer.vb @@ -28,16 +28,16 @@ Partial Class dlgDescribeTwoVarGraph Me.ucrSecondVariableReceiver = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() Me.ucrReceiverMultipleTwoVar = New instat.ucrVariablesAsFactor() - Me.ucrTwoVarGraphSave = New instat.ucrSaveGraph() Me.ucrSelectorTwoVarGraph = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrSaveGraph = New instat.ucrSave() Me.SuspendLayout() ' 'cmdOptions ' - Me.cmdOptions.Location = New System.Drawing.Point(320, 220) + Me.cmdOptions.Location = New System.Drawing.Point(10, 193) Me.cmdOptions.Name = "cmdOptions" - Me.cmdOptions.Size = New System.Drawing.Size(91, 23) - Me.cmdOptions.TabIndex = 11 + Me.cmdOptions.Size = New System.Drawing.Size(98, 23) + Me.cmdOptions.TabIndex = 5 Me.cmdOptions.Tag = "Options..." Me.cmdOptions.Text = "Options" Me.cmdOptions.UseVisualStyleBackColor = True @@ -48,16 +48,16 @@ Partial Class dlgDescribeTwoVarGraph Me.lblSecondVariable.Location = New System.Drawing.Point(261, 176) Me.lblSecondVariable.Name = "lblSecondVariable" Me.lblSecondVariable.Size = New System.Drawing.Size(88, 13) - Me.lblSecondVariable.TabIndex = 14 + Me.lblSecondVariable.TabIndex = 3 Me.lblSecondVariable.Text = "Second Variable:" ' 'lblFirstVariables ' Me.lblFirstVariables.AutoSize = True - Me.lblFirstVariables.Location = New System.Drawing.Point(261, 50) + Me.lblFirstVariables.Location = New System.Drawing.Point(261, 45) Me.lblFirstVariables.Name = "lblFirstVariables" Me.lblFirstVariables.Size = New System.Drawing.Size(81, 13) - Me.lblFirstVariables.TabIndex = 16 + Me.lblFirstVariables.TabIndex = 2 Me.lblFirstVariables.Tag = "First_Variable(s)" Me.lblFirstVariables.Text = "First Variable(s):" ' @@ -70,35 +70,28 @@ Partial Class dlgDescribeTwoVarGraph Me.ucrSecondVariableReceiver.Selector = Nothing Me.ucrSecondVariableReceiver.Size = New System.Drawing.Size(120, 20) Me.ucrSecondVariableReceiver.strNcFilePath = "" - Me.ucrSecondVariableReceiver.TabIndex = 13 + Me.ucrSecondVariableReceiver.TabIndex = 4 Me.ucrSecondVariableReceiver.ucrSelector = Nothing ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(12, 247) + Me.ucrBase.Location = New System.Drawing.Point(10, 257) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(410, 52) - Me.ucrBase.TabIndex = 0 + Me.ucrBase.TabIndex = 7 ' 'ucrReceiverMultipleTwoVar ' Me.ucrReceiverMultipleTwoVar.frmParent = Me - Me.ucrReceiverMultipleTwoVar.Location = New System.Drawing.Point(261, 35) + Me.ucrReceiverMultipleTwoVar.Location = New System.Drawing.Point(261, 30) Me.ucrReceiverMultipleTwoVar.Name = "ucrReceiverMultipleTwoVar" Me.ucrReceiverMultipleTwoVar.Selector = Nothing Me.ucrReceiverMultipleTwoVar.Size = New System.Drawing.Size(120, 138) Me.ucrReceiverMultipleTwoVar.strNcFilePath = "" - Me.ucrReceiverMultipleTwoVar.TabIndex = 15 + Me.ucrReceiverMultipleTwoVar.TabIndex = 1 Me.ucrReceiverMultipleTwoVar.ucrSelector = Nothing Me.ucrReceiverMultipleTwoVar.ucrVariableSelector = Nothing ' - 'ucrTwoVarGraphSave - ' - Me.ucrTwoVarGraphSave.Location = New System.Drawing.Point(12, 221) - Me.ucrTwoVarGraphSave.Name = "ucrTwoVarGraphSave" - Me.ucrTwoVarGraphSave.Size = New System.Drawing.Size(265, 20) - Me.ucrTwoVarGraphSave.TabIndex = 12 - ' 'ucrSelectorTwoVarGraph ' Me.ucrSelectorTwoVarGraph.bShowHiddenColumns = False @@ -107,18 +100,25 @@ Partial Class dlgDescribeTwoVarGraph Me.ucrSelectorTwoVarGraph.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorTwoVarGraph.Name = "ucrSelectorTwoVarGraph" Me.ucrSelectorTwoVarGraph.Size = New System.Drawing.Size(210, 180) - Me.ucrSelectorTwoVarGraph.TabIndex = 8 + Me.ucrSelectorTwoVarGraph.TabIndex = 0 + ' + 'ucrSaveGraph + ' + Me.ucrSaveGraph.Location = New System.Drawing.Point(10, 230) + Me.ucrSaveGraph.Name = "ucrSaveGraph" + Me.ucrSaveGraph.Size = New System.Drawing.Size(294, 24) + Me.ucrSaveGraph.TabIndex = 6 ' 'dlgDescribeTwoVarGraph ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(420, 306) + Me.ClientSize = New System.Drawing.Size(420, 315) + Me.Controls.Add(Me.ucrSaveGraph) Me.Controls.Add(Me.lblFirstVariables) Me.Controls.Add(Me.ucrReceiverMultipleTwoVar) Me.Controls.Add(Me.lblSecondVariable) Me.Controls.Add(Me.ucrSecondVariableReceiver) - Me.Controls.Add(Me.ucrTwoVarGraphSave) Me.Controls.Add(Me.cmdOptions) Me.Controls.Add(Me.ucrSelectorTwoVarGraph) Me.Controls.Add(Me.ucrBase) @@ -134,11 +134,11 @@ Partial Class dlgDescribeTwoVarGraph End Sub Friend WithEvents ucrBase As ucrButtons - Friend WithEvents ucrTwoVarGraphSave As ucrSaveGraph Friend WithEvents cmdOptions As Button Friend WithEvents ucrSelectorTwoVarGraph As ucrSelectorByDataFrameAddRemove Friend WithEvents ucrSecondVariableReceiver As ucrReceiverSingle Friend WithEvents lblSecondVariable As Label Friend WithEvents ucrReceiverMultipleTwoVar As ucrVariablesAsFactor Friend WithEvents lblFirstVariables As Label + Friend WithEvents ucrSaveGraph As ucrSave End Class \ No newline at end of file diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index a6100e73ee2..f596d730b25 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -14,77 +14,141 @@ ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . Imports instat.Translations -Imports RDotNet + Public Class dlgDescribeTwoVarGraph 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 bReset As Boolean = True + ' Private bResetSubdialog As Boolean = False + Private clsBaseOperator As New ROperator Private Sub dlgDescribeTwoVarGraph_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitialiseDialog() - SetDefaults() bFirstLoad = False End If - autoTranslate(Me) - End Sub - - Private Sub SetDefaults() - ucrReceiverMultipleTwoVar.SetMeAsReceiver() - ucrTwoVarGraphSave.Reset() - ucrSelectorTwoVarGraph.Reset() - ucrSelectorTwoVarGraph.Focus() - ucrTwoVarGraphSave.strPrefix = "TwoVariableGraph" - sdgDescribeTwoVarGraph.Initialise() + If bReset Then + SetDefaults() + End If + SetRCodeForControls(bReset) + bReset = False TestOkEnabled() + autoTranslate(Me) End Sub - Private Sub ucrTwoVarGraphSave_Load(sender As Object, e As EventArgs) + Private Sub InitialiseDialog() + ucrBase.iHelpTopicID = 416 + ucrBase.clsRsyntax.iCallType = 3 + ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False - End Sub + ucrSelectorTwoVarGraph.SetParameter(New RParameter("data", 0)) + ucrSelectorTwoVarGraph.SetParameterIsrfunction() - Private Sub InitialiseDialog() - ucrBase.clsRsyntax.SetOperation("+") - clsRGGplotFunction.SetRCommand("ggplot") - ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRGGplotFunction) ucrReceiverMultipleTwoVar.Selector = ucrSelectorTwoVarGraph ucrReceiverMultipleTwoVar.SetSingleTypeStatus(True) ucrReceiverMultipleTwoVar.SetMultipleOnlyStatus(True) + ucrSecondVariableReceiver.Selector = ucrSelectorTwoVarGraph - ucrTwoVarGraphSave.SetDataFrameSelector(ucrSelectorTwoVarGraph.ucrAvailableDataFrames) - ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False - ucrBase.clsRsyntax.iCallType = 3 + ucrSecondVariableReceiver.SetParameter(New RParameter("fill", 0)) + ucrSecondVariableReceiver.SetParameterIsString() + ucrSecondVariableReceiver.bWithQuotes = False + + ucrSaveGraph.SetPrefix("two_var") + ucrSaveGraph.SetSaveTypeAsGraph() + ucrSaveGraph.SetDataFrameSelector(ucrSelectorTwoVarGraph.ucrAvailableDataFrames) + ucrSaveGraph.SetCheckBoxText("Save Graph") + ucrSaveGraph.SetIsComboBox() + ucrSaveGraph.SetAssignToIfUncheckedValue("last_graph") + End Sub + + Private Sub SetDefaults() + clsRGGplotFunction = New RFunction + clsRBoxPlotGeom = New RFunction + clsRScatterPlotGeom = New RFunction + clsRLinePlotGeom = New RFunction + clsRSummaryAesFunction = New RFunction + clsRStatSummary = New RFunction + clsRFacet = New RFunction + clsRBoxAesFunction = New RFunction + clsRBoxAesFunction2 = New RFunction + clsRScatterAesFunction = New RFunction + clsRScatterAesFunction2 = New RFunction + clsRDotPlotGeom = New RFunction + clsRBarPlotGeom = New RFunction + clsRBarAesFunction = New RFunction + clsRDotAesFunction = New RFunction + clsRDotAesFunction2 = New RFunction + clsRFrequencyPolygonGeom = New RFunction + clsRHistogramGeom = New RFunction + clsRDensityPlotGeom = New RFunction + clsRFreqPolyAesFunction = New RFunction + clsRFreqPolyAesFunction2 = New RFunction + clsRHistAesFunction = New RFunction + clsRHistAesFunction2 = New RFunction + clsRDensityAesFunction = New RFunction + clsRDensityAesFunction2 = New RFunction + clsBaseOperator = New ROperator + + 'Reset + ucrSaveGraph.Reset() + ucrSelectorTwoVarGraph.Reset() + + ucrReceiverMultipleTwoVar.SetMeAsReceiver() + sdgDescribeTwoVarGraph.InitialiseControls() + + 'Defining functions and operators + clsBaseOperator.SetOperation("+") + clsRGGplotFunction.SetPackageName("ggplot2") + clsRGGplotFunction.SetRCommand("ggplot") + clsRFacet.SetPackageName("ggplot2") clsRFacet.SetRCommand("facet_wrap") clsRFacet.AddParameter("facets", "~variable") - ucrBase.clsRsyntax.AddOperatorParameter("facet_wrap", clsRFunc:=clsRFacet) - ucrBase.iHelpTopicID = 416 + clsBaseOperator.AddParameter("facet_wrap", clsRFunctionParameter:=clsRFacet) + clsBaseOperator.AddParameter("ggplot", clsRFunctionParameter:=clsRGGplotFunction, iPosition:=0) + clsBaseOperator.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorTwoVarGraph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") + ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator) + ' bResetSubdialog = True + End Sub + + Private Sub SetRCodeForControls(bReset As Boolean) + ucrSelectorTwoVarGraph.SetRCode(clsRGGplotFunction, bReset) + ucrSecondVariableReceiver.SetRCode(clsRBarAesFunction, bReset) + ucrSaveGraph.SetRCode(clsBaseOperator, bReset) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRScatterAesFunction, New RParameter("x", 0), iAdditionalPairNo:=1) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRBoxAesFunction, New RParameter("x", 0), iAdditionalPairNo:=2) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRDotAesFunction, New RParameter("y", 0), iAdditionalPairNo:=3) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRFreqPolyAesFunction, New RParameter("color", 0), iAdditionalPairNo:=4) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRHistAesFunction, New RParameter("color", 0), iAdditionalPairNo:=5) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRDensityAesFunction, New RParameter("color", 0), iAdditionalPairNo:=6) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRScatterAesFunction2, New RParameter("y", 0), iAdditionalPairNo:=7) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRBoxAesFunction2, New RParameter("y", 0), iAdditionalPairNo:=8) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRDotAesFunction2, New RParameter("x", 0), iAdditionalPairNo:=9) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRFreqPolyAesFunction2, New RParameter("x", 0), iAdditionalPairNo:=10) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRHistAesFunction2, New RParameter("x", 0), iAdditionalPairNo:=11) + ucrSecondVariableReceiver.AddAdditionalCodeParameterPair(clsRDensityAesFunction2, New RParameter("x", 0), iAdditionalPairNo:=12) End Sub Private Sub TestOkEnabled() - If ucrReceiverMultipleTwoVar.IsEmpty Or ucrSecondVariableReceiver.IsEmpty Or (ucrTwoVarGraphSave.chkSaveGraph.Checked And ucrTwoVarGraphSave.ucrInputGraphName.IsEmpty) Then - ucrBase.OKEnabled(False) - Else + If Not ucrReceiverMultipleTwoVar.IsEmpty AndAlso Not ucrSecondVariableReceiver.IsEmpty AndAlso ucrSaveGraph.IsComplete Then ucrBase.OKEnabled(True) - Results() + Else + ucrBase.OKEnabled(False) End If End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() - End Sub - - Private Sub ucrTwoVarGraphSave_Load() Handles ucrTwoVarGraphSave.GraphNameChanged, ucrTwoVarGraphSave.SaveGraphCheckedChanged, ucrTwoVarGraphSave.Load - If ucrTwoVarGraphSave.bSaveGraph Then - ucrBase.clsRsyntax.SetAssignTo(ucrTwoVarGraphSave.strGraphName, strTempDataframe:=ucrSelectorTwoVarGraph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrTwoVarGraphSave.strGraphName) - Else - ucrBase.clsRsyntax.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorTwoVarGraph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") - End If + SetRCodeForControls(True) TestOkEnabled() End Sub Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click + ' sdgDescribeTwoVarGraph.SetRFunction(clsBaseOperator, bResetSubdialog) + ' bResetSubdialog = False sdgDescribeTwoVarGraph.ShowDialog() + TestOkEnabled() End Sub Public Sub Results() @@ -98,91 +162,93 @@ Public Class dlgDescribeTwoVarGraph If ((strVarType = "numeric" OrElse strVarType = "integer") AndAlso (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then ScatterLinePlot() clsRFacet.RemoveParameterByName("scale") + clsBaseOperator.RemoveParameterByName("geom_line") Select Case sdgDescribeTwoVarGraph.ucrNumericByNumeric.GetText Case "Scatter plot" - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRScatterPlotGeom, iPosition:=1) Case "Line plot" - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) - ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRLinePlotGeom, iPosition:=1) + Case "Scatter and line plot" - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) - ucrBase.clsRsyntax.AddOperatorParameter("geom_point", clsRFunc:=clsRScatterPlotGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRLinePlotGeom, iPosition:=1) + clsBaseOperator.AddParameter("geom_line", clsRFunctionParameter:=clsRScatterPlotGeom, iPosition:=2) End Select 'numeric by categorical case ElseIf (strVarType = "numeric" OrElse strVarType = "integer") AndAlso (strSecondVarType <> "numeric" AndAlso strSecondVarType <> "integer") Then clsRFacet.RemoveParameterByName("scale") - ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") + clsBaseOperator.RemoveParameterByName("geom_line") Select Case sdgDescribeTwoVarGraph.ucrNumericByCategorical.GetText Case "Box plot" BoxPlot() - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBoxAesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBoxPlotGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBoxAesFunction, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRBoxPlotGeom, iPosition:=1) Case "Frequency polygon" FrequencyPolygon() - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRFreqPolyAesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRFrequencyPolygonGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRFreqPolyAesFunction, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRFrequencyPolygonGeom, iPosition:=1) Case "Histogram" Histogram() - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRHistAesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRHistogramGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRHistAesFunction, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRHistogramGeom, iPosition:=1) Case "Density plot" DensityPlot() - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDensityPlotGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRDensityPlotGeom, iPosition:=1) Case "Dot plot" DotPlot() - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRDotPlotGeom, iPosition:=1) Case "Point plot" ScatterLinePlot() - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRScatterPlotGeom, iPosition:=1) End Select 'categorical by numeric case ElseIf (strVarType <> "numeric" AndAlso strVarType <> "integer") AndAlso (strSecondVarType = "numeric" OrElse strSecondVarType = "integer") Then - ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") + clsBaseOperator.RemoveParameterByName("geom_line") 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) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBoxAesFunction2, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRBoxPlotGeom, iPosition:=1) Case "Frequency polygon" FrequencyPolygon() - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRFreqPolyAesFunction2) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRFrequencyPolygonGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRFreqPolyAesFunction2, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRFrequencyPolygonGeom, iPosition:=1) Case "Histogram" Histogram() - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRHistAesFunction2) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRHistogramGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRHistAesFunction2, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRHistogramGeom, iPosition:=1) Case "Density plot" DensityPlot() - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction2) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDensityPlotGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction2, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRDensityPlotGeom, iPosition:=1) Case "Dot plot" DotPlot() - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction2) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction2, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRDotPlotGeom, iPosition:=1) Case "Point plot" ScatterLinePlot() - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction2) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction2, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRScatterPlotGeom, iPosition:=1) End Select 'catogerical by cateogrical case ElseIf (strVarType <> "numeric" AndAlso strVarType <> "integer") AndAlso (strVarType <> "numeric" AndAlso strVarType <> "integer") Then - ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") + clsBaseOperator.RemoveParameterByName("geom_line") 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) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRDotPlotGeom, iPosition:=1) Case "Bar plot" BarPlot() - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBarPlotGeom) + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBarAesFunction, iPosition:=0) + clsBaseOperator.AddParameter("geom", clsRFunctionParameter:=clsRBarPlotGeom, iPosition:=1) End Select 'Should never reach this case Else @@ -191,90 +257,90 @@ Public Class dlgDescribeTwoVarGraph End If End Sub - Private Sub ucrSelectorTwoVarGraph_DataFrameChanged() Handles ucrSelectorTwoVarGraph.DataFrameChanged - clsRGGplotFunction.AddParameter("data", clsRFunctionParameter:=ucrSelectorTwoVarGraph.ucrAvailableDataFrames.clsCurrDataFrame) - End Sub - - Private Sub ucrSecondVariableReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrSecondVariableReceiver.SelectionChanged - 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 - - Private Sub ucrReceiverMultipleTwoVar_SelectionChanged() Handles ucrReceiverMultipleTwoVar.SelectionChanged - TestOkEnabled() - End Sub - Private Sub BoxPlot() + clsRBoxPlotGeom.SetPackageName("ggplot2") clsRBoxPlotGeom.SetRCommand("geom_boxplot") + clsRBoxAesFunction.SetPackageName("ggplot2") clsRBoxAesFunction.SetRCommand("aes") clsRBoxAesFunction.AddParameter("y", "value") + clsRBoxAesFunction2.SetPackageName("ggplot2") clsRBoxAesFunction2.SetRCommand("aes") clsRBoxAesFunction2.AddParameter("x", "value") End Sub Private Sub ScatterLinePlot() + clsRScatterPlotGeom.SetPackageName("ggplot2") clsRScatterPlotGeom.SetRCommand("geom_point") + clsRLinePlotGeom.SetPackageName("ggplot2") clsRLinePlotGeom.SetRCommand("geom_line") + clsRScatterAesFunction.SetPackageName("ggplot2") clsRScatterAesFunction.SetRCommand("aes") clsRScatterAesFunction.AddParameter("y", "value") + clsRScatterAesFunction2.SetPackageName("ggplot2") clsRScatterAesFunction2.SetRCommand("aes") clsRScatterAesFunction2.AddParameter("x", "value") End Sub - Private Sub DotPlot() + clsRDotPlotGeom.SetPackageName("ggplot2") clsRDotPlotGeom.SetRCommand("geom_dotplot") clsRDotPlotGeom.AddParameter("binaxis", Chr(34) & "y" & Chr(34)) + clsRDotAesFunction.SetPackageName("ggplot2") clsRDotAesFunction.SetRCommand("aes") clsRDotAesFunction.AddParameter("x", "value") + clsRDotAesFunction2.SetPackageName("ggplot2") clsRDotAesFunction2.SetRCommand("aes") clsRDotAesFunction2.AddParameter("y", "value") End Sub Private Sub BarPlot() + clsRBarPlotGeom.SetPackageName("ggplot2") clsRBarPlotGeom.SetRCommand("geom_bar") clsRBarPlotGeom.AddParameter("position", Chr(34) & "dodge" & Chr(34)) + clsRBarAesFunction.SetPackageName("ggplot2") clsRBarAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBarAesFunction) clsRBarAesFunction.AddParameter("x", "value") End Sub Private Sub FrequencyPolygon() + clsRFrequencyPolygonGeom.SetPackageName("ggplot2") clsRFrequencyPolygonGeom.SetRCommand("geom_freqpoly") + clsRFreqPolyAesFunction.SetPackageName("ggplot2") clsRFreqPolyAesFunction.SetRCommand("aes") clsRFreqPolyAesFunction.AddParameter("x", "value") + clsRFreqPolyAesFunction2.SetPackageName("ggplot2") clsRFreqPolyAesFunction2.SetRCommand("aes") clsRFreqPolyAesFunction2.AddParameter("color", "value") End Sub Private Sub DensityPlot() + clsRDensityPlotGeom.SetPackageName("ggplot2") clsRDensityPlotGeom.SetRCommand("geom_density") + clsRDensityAesFunction.SetPackageName("ggplot2") clsRDensityAesFunction.SetRCommand("aes") clsRDensityAesFunction.AddParameter("x", "value") + clsRDensityAesFunction2.SetPackageName("ggplot2") clsRDensityAesFunction2.SetRCommand("aes") clsRDensityAesFunction2.AddParameter("color", "value") End Sub Private Sub Histogram() + clsRHistogramGeom.SetPackageName("ggplot2") clsRHistogramGeom.SetRCommand("geom_histogram") clsRHistogramGeom.AddParameter("position", Chr(34) & "dodge" & Chr(34)) + clsRHistAesFunction.SetPackageName("ggplot2") clsRHistAesFunction.SetRCommand("aes") clsRHistAesFunction.AddParameter("x", "value") + clsRHistAesFunction2.SetPackageName("ggplot2") clsRHistAesFunction2.SetRCommand("aes") clsRHistAesFunction2.AddParameter("color", "value") End Sub + + Private Sub Controls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSecondVariableReceiver.ControlValueChanged, ucrReceiverMultipleTwoVar.ControlValueChanged + Results() + End Sub + + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSecondVariableReceiver.ControlContentsChanged, ucrReceiverMultipleTwoVar.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged + TestOkEnabled() + End Sub End Class \ No newline at end of file diff --git a/instat/dlgMakeDate.vb b/instat/dlgMakeDate.vb index ad4aa7ee19a..d4363a9ac88 100644 --- a/instat/dlgMakeDate.vb +++ b/instat/dlgMakeDate.vb @@ -42,43 +42,52 @@ Public Class dlgMakeDate Private Sub InitialiseDialog() 'helpID ucrBase.iHelpTopicID = 461 + Dim dctYearItems As New Dictionary(Of String, String) + Dim dctMonthItems As New Dictionary(Of String, String) + Dim dctDayItems As New Dictionary(Of String, String) + Dim dctMonthTwoItems As New Dictionary(Of String, String) + Dim dctDateFormat As New Dictionary(Of String, String) + Dim dctdateorigin As New Dictionary(Of String, String) + 'Dim dctDayItemsDOY As New Dictionary(Of String, String) + 'Dim dctDayItemsDOY As New Dictionary(Of String, String) ucrInputMonthOption.SetParameter(New RParameter("month_format", 5)) - Dim dctMonthItems As New Dictionary(Of String, String) dctMonthItems.Add("Numerical", Chr(34) & "%m" & Chr(34)) dctMonthItems.Add("Partial Word", Chr(34) & "%b" & Chr(34)) dctMonthItems.Add("Full Word", Chr(34) & "%B" & Chr(34)) ucrInputMonthOption.SetItems(dctMonthItems) + ucrInputMonthOption.SetDropDownStyleAsEditable(bAdditionsAllowed:=True) ucrInputDayOption.SetParameter(New RParameter("day_format", 4)) - Dim dctDayItems As New Dictionary(Of String, String) dctDayItems.Add("By Month", Chr(34) & "%d" & Chr(34)) ucrInputDayOption.SetItems(dctDayItems) + ucrInputDayOption.SetDropDownStyleAsEditable(bAdditionsAllowed:=True) ucrInputComboBoxMonthTwo.SetParameter(New RParameter("doy_typical_length", 3)) - Dim dctMonthTwoItems As New Dictionary(Of String, String) dctMonthTwoItems.Add("365/366", Chr(34) & "365/366" & Chr(34)) dctMonthTwoItems.Add("366", Chr(34) & "366" & Chr(34)) ucrInputComboBoxMonthTwo.SetItems(dctMonthTwoItems) + ucrInputComboBoxMonthTwo.SetDropDownStyleAsEditable(bAdditionsAllowed:=True) ucrInputFormat.SetParameter(New RParameter("format", 1)) - Dim dctDateFormat As New Dictionary(Of String, String) dctDateFormat.Add("Year-Month-Day", Chr(34) & "%Y-%m-%d" & Chr(34)) dctDateFormat.Add("Year/Month/Day", Chr(34) & "%Y/%m/%d" & Chr(34)) dctDateFormat.Add("Day-Month-Year", Chr(34) & "%d-%m-%Y" & Chr(34)) ucrInputFormat.SetItems(dctDateFormat) + ucrInputFormat.SetDropDownStyleAsEditable(bAdditionsAllowed:=True) ucrInputOrigin.SetParameter(New RParameter("origin", 1)) - Dim dctdateorigin As New Dictionary(Of String, String) dctdateorigin.Add("Excel", Chr(34) & "1899-12-30" & Chr(34)) dctdateorigin.Add("Gregorian", Chr(34) & "1600-03-01" & Chr(34)) ucrInputOrigin.SetItems(dctdateorigin) + ucrInputOrigin.SetDropDownStyleAsEditable(bAdditionsAllowed:=True) + ucrInputYearOption.SetParameter(New RParameter("year_format", 6)) - Dim dctYearItems As New Dictionary(Of String, String) dctYearItems.Add("4 Digit", Chr(34) & "%Y" & Chr(34)) dctYearItems.Add("2 Digit", Chr(34) & "%y" & Chr(34)) ucrInputYearOption.SetItems(dctYearItems) + ucrInputYearOption.SetDropDownStyleAsEditable(bAdditionsAllowed:=True) 'TODO - ucrinputFomat 'ucrInputSeparator.SetItems({"/", "-", "_", ".", ",", ";", ":"}) @@ -87,7 +96,6 @@ Public Class dlgMakeDate 'ucrInputMonth.SetItems({"Numerical", "Partial Word", "Full Word"}) 'ucrInputDay.SetParameter(New RParameter("")) - 'Dim dctDayItemsDOY As New Dictionary(Of String, String) 'dctDayItemsDOY.Add("By Month", Chr(34) & "%d" & Chr(34)) 'dctDayItemsDOY.Add("By Year", Chr(34) & "%j" & Chr(34)) 'ucrInputDay.SetItems(dctDayItemsDOY) @@ -97,7 +105,6 @@ Public Class dlgMakeDate 'ucrInputMonth.SetItems({"Numerical", "Partial Word", "Full Word"}) 'ucrInputDay.SetParameter(New RParameter("")) - 'Dim dctDayItemsDOY As New Dictionary(Of String, String) 'dctDayItemsDOY.Add("By Month", Chr(34) & "%d" & Chr(34)) 'dctDayItemsDOY.Add("By Year", Chr(34) & "%j" & Chr(34)) 'ucrInputDay.SetItems(dctDayItemsDOY) @@ -170,12 +177,11 @@ Public Class dlgMakeDate ucrPnlDate.AddToLinkedControls(ucrPnlFormat, {rdoSingleColumn}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlDate.AddToLinkedControls(ucrReceiverForDate, {rdoSingleColumn}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrReceiverForDate.SetLinkedDisplayControl(grpSingleColumn) - ucrPnlDate.bAllowNonConditionValues = False - ''linking up ucrinputs for format and origin - ucrPnlFormat.AddToLinkedControls(ucrInputFormat, {rdoSpecifyFormat}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrPnlFormat.AddToLinkedControls(ucrInputOrigin, {rdoSpecifyOrigin}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrPnlFormat.bAllowNonConditionValues = False + ''linking up ucrinputs for format and origin + ucrPnlFormat.AddToLinkedControls(ucrInputFormat, {rdoSpecifyFormat}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="Year-Month-Day") + ucrPnlFormat.AddToLinkedControls(ucrInputOrigin, {rdoSpecifyOrigin}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="Excel") + 'when rdoTwoColumn is checked ucrPnlDate.AddToLinkedControls(ucrReceiverYearTwo, {rdoTwoColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrReceiverYearTwo.SetLinkedDisplayControl(lblYearTwo) @@ -184,7 +190,7 @@ Public Class dlgMakeDate ucrPnlDate.AddToLinkedControls(ucrChkTwoDigitYear, {rdoTwoColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=True) ucrChkTwoDigitYear.AddToLinkedControls(ucrNudCutoff, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrNudCutoff.SetLinkedDisplayControl(lblCutOffTwo) - ucrPnlDate.AddToLinkedControls(ucrInputComboBoxMonthTwo, {rdoTwoColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlDate.AddToLinkedControls(ucrInputComboBoxMonthTwo, {rdoTwoColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="365/366") ucrReceiverYearTwo.SetLinkedDisplayControl(grpTwoColumns) 'when rdoThreeColumn is checked @@ -194,11 +200,11 @@ Public Class dlgMakeDate ucrReceiverMonthThree.SetLinkedDisplayControl(lblMonthThree) ucrPnlDate.AddToLinkedControls(ucrReceiverDayThree, {rdoThreeColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrReceiverDayThree.SetLinkedDisplayControl(lblDayofMonth) - ucrPnlDate.AddToLinkedControls(ucrInputYearOption, {rdoThreeColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlDate.AddToLinkedControls(ucrInputYearOption, {rdoThreeColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="4 Digit") ucrInputYearOption.SetLinkedDisplayControl(lblYearOption) - ucrPnlDate.AddToLinkedControls(ucrInputMonthOption, {rdoThreeColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlDate.AddToLinkedControls(ucrInputMonthOption, {rdoThreeColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="Numerical") ucrInputMonthOption.SetLinkedDisplayControl(lblMonthOption) - ucrPnlDate.AddToLinkedControls(ucrInputDayOption, {rdoThreeColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlDate.AddToLinkedControls(ucrInputDayOption, {rdoThreeColumns}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="By Month") ucrInputDayOption.SetLinkedDisplayControl(lblDayOption) ucrReceiverYearThree.SetLinkedDisplayControl(grpThreeColumns) @@ -237,17 +243,7 @@ Public Class dlgMakeDate clsMakeYearMonthDay.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$make_date_yearmonthday") clsDateFunction.AddParameter("x", clsRFunctionParameter:=ucrReceiverForDate.GetVariables()) clsDateFunction.SetAssignTo(ucrSaveDate.GetText, strTempDataframe:=ucrSelectorMakeDate.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=ucrSaveDate.GetText) - - clsDateFunction.AddParameter("format", Chr(34) & "%Y-%m-%d" & Chr(34)) - clsDateFunction.AddParameter("origin", Chr(34) & "1899-12-30" & Chr(34)) - clsMakeYearDay.AddParameter("year_format", Chr(34) & "%Y" & Chr(34)) - - clsMakeYearDay.AddParameter("doy_typical_length", Chr(34) & "365/366" & Chr(34)) - clsMakeYearMonthDay.AddParameter("day_format", Chr(34) & "%d" & Chr(34)) - clsMakeYearMonthDay.AddParameter("month_format", Chr(34) & "%m" & Chr(34)) - clsMakeYearMonthDay.AddParameter("year_format", Chr(34) & "%Y" & Chr(34)) ucrBase.clsRsyntax.SetBaseRFunction(clsDateFunction) - End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -267,6 +263,8 @@ Public Class dlgMakeDate ucrChkMore.SetRCode(clsDateFunction, bReset) + ucrPnlFormat.SetRCode(clsDateFunction, bReset) + ucrReceiverDayTwo.SetRCode(clsMakeYearDay, bReset) ucrReceiverYearTwo.SetRCode(clsMakeYearDay, bReset) ucrReceiverYearThree.SetRCode(clsMakeYearMonthDay, bReset) @@ -274,7 +272,7 @@ Public Class dlgMakeDate ucrReceiverDayThree.SetRCode(clsMakeYearMonthDay, bReset) ucrSelectorMakeDate.SetRCode(clsMakeYearMonthDay, bReset) ucrSelectorMakeDate.SetRCode(clsMakeYearDay, bReset) - + GroupBoxDisplayOnReOpen() End Sub Public Sub SetCurrentColumn(strColumn As String, strDataFrame As String) @@ -292,7 +290,6 @@ Public Class dlgMakeDate End Sub Private Sub TestOKEnabled() - If ucrSaveDate.IsComplete Then ' we have three radio buttons, so need to define when OK can be enabled for each radio button. If rdoSingleColumn.Checked Then @@ -373,4 +370,20 @@ Public Class dlgMakeDate ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) End If End Sub + + 'Temporary fix: This should be deleted since - this should be automatic + Private Sub GroupBoxDisplayOnReOpen() + If rdoSingleColumn.Checked Then + grpSingleColumn.Visible = True + ElseIf rdoTwoColumns.Checked Then + grpTwoColumns.Visible = True + Else + grpThreeColumns.Visible = True + End If + End Sub + + Private Sub ucrPnDate_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlDate.ControlValueChanged + + End Sub + End Class \ No newline at end of file diff --git a/instat/dlgTransformText.vb b/instat/dlgTransformText.vb index 094c1ac35f7..cadc76537e3 100644 --- a/instat/dlgTransformText.vb +++ b/instat/dlgTransformText.vb @@ -36,6 +36,9 @@ Public Class dlgTransformText End Sub Private Sub InitialiseDialog() + Dim dctInputPad As New Dictionary(Of String, String) + Dim dctInputSeparator As New Dictionary(Of String, String) + ucrBase.iHelpTopicID = 343 ucrBase.clsRsyntax.bUseBaseFunction = True @@ -78,7 +81,6 @@ Public Class dlgTransformText ucrPnlOperation.AddToLinkedControls(ucrNudWidth, {rdoPad}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) 'ucrInputPad - Dim dctInputPad As New Dictionary(Of String, String) ucrInputPad.SetParameter(New RParameter("pad", 3)) dctInputPad.Add("Space ( )", Chr(34) & " " & Chr(34)) dctInputPad.Add("Hash #", Chr(34) & "#" & Chr(34)) @@ -88,6 +90,7 @@ Public Class dlgTransformText ucrInputPad.SetItems(dctInputPad) ucrInputPad.SetLinkedDisplayControl(lblPad) ucrInputPad.SetRDefault(Chr(34) & " " & Chr(34)) + ucrInputPad.bAllowNonConditionValues = True 'ucrNudWidth ucrNudWidth.SetParameter(New RParameter("width", 1)) @@ -139,7 +142,6 @@ Public Class dlgTransformText ucrChkLastOr.AddParameterIsRFunctionCondition(True, "start", True) ' ucrInputSeparator - Dim dctInputSeparator As New Dictionary(Of String, String) ucrInputSeparator.SetParameter(New RParameter("sep", 3)) dctInputSeparator.Add("Space ( )", "fixed(" & Chr(34) & " " & Chr(34) & ")") dctInputSeparator.Add("Colon :", Chr(34) & ":" & Chr(34)) @@ -148,6 +150,7 @@ Public Class dlgTransformText ucrInputSeparator.SetItems(dctInputSeparator) ucrInputSeparator.SetLinkedDisplayControl(lblSeparator) ucrInputSeparator.SetRDefault("fixed(" & Chr(34) & " " & Chr(34) & ")") + ucrInputSeparator.bAllowNonConditionValues = True 'rdoSubstring ucrPnlOperation.AddToLinkedControls(ucrNudFrom, {rdoSubstring}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) diff --git a/instat/sdgDescribeTwoVarGraph.vb b/instat/sdgDescribeTwoVarGraph.vb index fc6944aeb1f..997ce3932e2 100644 --- a/instat/sdgDescribeTwoVarGraph.vb +++ b/instat/sdgDescribeTwoVarGraph.vb @@ -15,27 +15,64 @@ ' along with this program. If not, see . Imports instat.Translations Public Class sdgDescribeTwoVarGraph + ' Public bControlsInitialised As Boolean = False + 'Public clsGraphOneVariable As New ROperator Public bFirstLoad As Boolean = True + Private Sub sdgDescribeTwoVarGraph_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) - If bFirstLoad Then - 'SetDefaults() bFirstLoad = False End If End Sub - Public Sub Initialise() + Public Sub InitialiseControls() + 'Dim dctNumericByNumericPairs As New Dictionary(Of String, String) + 'Dim dctucrNumericByCategorical As New Dictionary(Of String, String) + 'Dim dctucrCategoricalByNumeric As New Dictionary(Of String, String) + 'Dim dctucrCategoricalByCategorical As New Dictionary(Of String, String) + + 'dctNumericByNumericPairs.Add("Scatter plot", Chr(34) & "geom_point" & Chr(34)) + 'dctNumericByNumericPairs.Add("Line plot", Chr(34) & "geom_boxplot" & Chr(34)) + 'dctNumericByNumericPairs.Add("Scatter and line plot", Chr(34) & "geom_line" & Chr(34)) + '' dctNumericByNumericPairs.Add("Scatter and line plot", Chr(34) & "geom_point" & Chr(34)) + 'ucrNumericByNumeric.SetItems(dctNumericByNumericPairs) + + 'dctucrNumericByCategorical.Add("Box plot", Chr(34) & "geom_boxplot" & Chr(34)) + 'dctucrNumericByCategorical.Add("Histogram", Chr(34) & "geom_histogram" & Chr(34)) + 'dctucrNumericByCategorical.Add("Density plot", Chr(34) & "geom_density" & Chr(34)) + 'dctucrNumericByCategorical.Add("Frequency polygon", Chr(34) & "geom_freqpoly" & Chr(34)) + 'dctucrNumericByCategorical.Add("Dot plot", Chr(34) & "geom_dotplot" & Chr(34)) + 'dctucrNumericByCategorical.Add("Point plot", Chr(34) & "geom_point" & Chr(34)) + 'ucrNumericByCategorical.SetItems(dctucrNumericByCategorical) + + + 'dctucrCategoricalByNumeric.Add("Box plot", Chr(34) & "geom_boxplot" & Chr(34)) + 'dctucrCategoricalByNumeric.Add("Histogram", Chr(34) & "geom_histogram" & Chr(34)) + 'dctucrCategoricalByNumeric.Add("Density plot", Chr(34) & "geom_density" & Chr(34)) + 'dctucrCategoricalByNumeric.Add("Frequency polygon", Chr(34) & "geom_freqpoly" & Chr(34)) + 'dctucrCategoricalByNumeric.Add("Dot plot", Chr(34) & "geom_dotplot" & Chr(34)) + 'dctucrCategoricalByNumeric.Add("Point plot", Chr(34) & "geom_point" & Chr(34)) + 'ucrCategoricalByNumeric.SetItems(dctucrCategoricalByNumeric) + + 'dctucrCategoricalByCategorical.Add("Dot plot", Chr(34) & "geom_dotplot" & Chr(34)) + 'dctucrCategoricalByCategorical.Add("Point plot", Chr(34) & "geom_point" & Chr(34)) + 'ucrCategoricalByCategorical.SetItems(dctucrCategoricalByCategorical) + ucrNumericByNumeric.SetItems({"Scatter plot", "Line plot", "Scatter and line plot"}) ucrNumericByNumeric.SetName("Scatter plot") + ucrNumericByNumeric.SetDropDownStyleAsNonEditable() ucrNumericByCategorical.SetItems({"Box plot", "Histogram", "Density plot", "Frequency polygon", "Dot plot", "Point plot"}) 'How different is the point plot from the summary plot? ucrNumericByCategorical.SetName("Box plot") + ucrNumericByCategorical.SetDropDownStyleAsNonEditable() 'ucrCategoricalByNumeric.SetItems({"Summary plot"}) ucrCategoricalByNumeric.SetItems({"Box plot", "Histogram", "Density plot", "Frequency polygon", "Dot plot", "Point plot"}) ucrCategoricalByNumeric.SetName("Box plot") + ucrCategoricalByNumeric.SetDropDownStyleAsNonEditable() ucrCategoricalByCategorical.SetItems({"Bar plot", "Dot plot"}) ucrCategoricalByCategorical.SetName("Bar plot") + ucrCategoricalByCategorical.SetDropDownStyleAsNonEditable() End Sub 'Public Sub GrpBoxEnable() @@ -63,6 +100,14 @@ Public Class sdgDescribeTwoVarGraph ' End If 'End Sub + 'Public Sub SetRFunction(clsNewGraphOneVariable As ROperator, Optional bReset As Boolean = False) + ' If Not bControlsInitialised Then + ' InitialiseControls() + ' End If + ' clsGraphOneVariable = clsNewGraphOneVariable + + 'End Sub + Private Sub ucrGraphs_NameChanged() Handles ucrNumericByNumeric.NameChanged, ucrNumericByCategorical.NameChanged, ucrCategoricalByNumeric.NameChanged, ucrCategoricalByCategorical.NameChanged dlgDescribeTwoVarGraph.Results() End Sub diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index 1442ff96546..d1f52c0fea1 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -1941,7 +1941,7 @@ data_object$set("public","split_date", function(col_name = "", week = FALSE, mon self$add_columns_to_data(col_name = col_name, col_data = weekday_name_vector) } if(month_val) { - month_val_vector <- as.integer(month(col_data)) + month_val_vector <- as.integer(lubridate::month(col_data)) col_name <- next_default_item(prefix = "month_val", existing_names = self$get_column_names(), include_index = FALSE) self$add_columns_to_data(col_name = col_name, col_data = month_val_vector) } diff --git a/instat/ucrInputComboBox.vb b/instat/ucrInputComboBox.vb index 0374b9979b3..6b8b24f520d 100644 --- a/instat/ucrInputComboBox.vb +++ b/instat/ucrInputComboBox.vb @@ -17,6 +17,16 @@ Imports System.ComponentModel Public Class ucrInputComboBox Dim strItemsType As String = "" + + Public Sub New() + + ' This call is required by the designer. + InitializeComponent() + + ' Add any initialization after the InitializeComponent() call. + bAllowNonConditionValues = False + End Sub + 'temporary event which is only raised when index is changed 'NameChanged raised any time value is set (even if it's the same) Public Event SelectionIndexChanged() @@ -193,7 +203,6 @@ Public Class ucrInputComboBox End Function Private Sub ucrInputComboBox_Load(sender As Object, e As EventArgs) Handles Me.Load - bAllowNonConditionValues = False FillItemTypes() If bFirstLoad Then bFirstLoad = False