From 610660ae626fe7d39360bd1ec76e1a3805a38a61 Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Mon, 29 Jan 2024 17:02:09 +0300 Subject: [PATCH 1/3] changes --- instat/dlgBarAndPieChart.Designer.vb | 104 +++++++-- instat/dlgBarAndPieChart.vb | 243 +++++++++++++++++++ instat/dlgHistogram.designer.vb | 76 +++++- instat/dlgHistogram.vb | 274 +++++++++++++++++++++- instat/dlgLinePlot.designer.vb | 334 ++++++++++++++++----------- instat/dlgLinePlot.vb | 241 +++++++++++++++++++ instat/dlgScatterPlot.Designer.vb | 76 +++++- instat/dlgScatterPlot.vb | 244 +++++++++++++++++++ 8 files changed, 1428 insertions(+), 164 deletions(-) diff --git a/instat/dlgBarAndPieChart.Designer.vb b/instat/dlgBarAndPieChart.Designer.vb index 7e857d855c2..a319b8a4e5d 100644 --- a/instat/dlgBarAndPieChart.Designer.vb +++ b/instat/dlgBarAndPieChart.Designer.vb @@ -67,9 +67,10 @@ Partial Class dlgBarAndPieChart Me.contextMenuStripOptions = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.toolStripMenuItemPlotOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemBarchartOptions = New System.Windows.Forms.ToolStripMenuItem() - Me.toolStripMenuItemLollipopOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemTextOptions = New System.Windows.Forms.ToolStripMenuItem() + Me.toolStripMenuItemLollipopOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemTreemapOptions = New System.Windows.Forms.ToolStripMenuItem() + Me.toolStripMenuItemTreemapTextOptionsOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemWordcloudOptions = New System.Windows.Forms.ToolStripMenuItem() Me.cmdOptions = New instat.ucrSplitButton() Me.ucrChkReorderValue = New instat.ucrCheck() @@ -111,7 +112,11 @@ Partial Class dlgBarAndPieChart Me.ucrChkAddLabelsTreemap = New instat.ucrCheck() Me.ucrChkBacktoback = New instat.ucrCheck() Me.ucrChkIncreaseSize = New instat.ucrCheck() - Me.toolStripMenuItemTreemapTextOptionsOptions = New System.Windows.Forms.ToolStripMenuItem() + Me.ucrInputStation = New instat.ucrInputComboBox() + Me.ucr1stFactorReceiver = New instat.ucrReceiverSingle() + Me.lblFacetBy = New System.Windows.Forms.Label() + Me.ucrInputLegendPosition = New instat.ucrInputComboBox() + Me.ucrChkLegend = New instat.ucrCheck() Me.contextMenuStripOptions.SuspendLayout() Me.SuspendLayout() ' @@ -390,7 +395,7 @@ Partial Class dlgBarAndPieChart ' Me.contextMenuStripOptions.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripMenuItemPlotOptions, Me.toolStripMenuItemBarchartOptions, Me.toolStripMenuItemTextOptions, Me.toolStripMenuItemLollipopOptions, Me.toolStripMenuItemTreemapOptions, Me.toolStripMenuItemTreemapTextOptionsOptions, Me.toolStripMenuItemWordcloudOptions}) Me.contextMenuStripOptions.Name = "contextMenuStripOk" - Me.contextMenuStripOptions.Size = New System.Drawing.Size(189, 180) + Me.contextMenuStripOptions.Size = New System.Drawing.Size(189, 158) ' 'toolStripMenuItemPlotOptions ' @@ -404,24 +409,30 @@ Partial Class dlgBarAndPieChart Me.toolStripMenuItemBarchartOptions.Size = New System.Drawing.Size(188, 22) Me.toolStripMenuItemBarchartOptions.Text = "BarChart Options" ' - 'toolStripMenuItemLollipopOptions - ' - Me.toolStripMenuItemLollipopOptions.Name = "toolStripMenuItemLollipopOptions" - Me.toolStripMenuItemLollipopOptions.Size = New System.Drawing.Size(188, 22) - Me.toolStripMenuItemLollipopOptions.Text = "Lollipop Options" - ' 'toolStripMenuItemTextOptions ' Me.toolStripMenuItemTextOptions.Name = "toolStripMenuItemTextOptions" Me.toolStripMenuItemTextOptions.Size = New System.Drawing.Size(188, 22) Me.toolStripMenuItemTextOptions.Text = "Text Options" ' + 'toolStripMenuItemLollipopOptions + ' + Me.toolStripMenuItemLollipopOptions.Name = "toolStripMenuItemLollipopOptions" + Me.toolStripMenuItemLollipopOptions.Size = New System.Drawing.Size(188, 22) + Me.toolStripMenuItemLollipopOptions.Text = "Lollipop Options" + ' 'toolStripMenuItemTreemapOptions ' Me.toolStripMenuItemTreemapOptions.Name = "toolStripMenuItemTreemapOptions" Me.toolStripMenuItemTreemapOptions.Size = New System.Drawing.Size(188, 22) Me.toolStripMenuItemTreemapOptions.Text = "Treemap Options" ' + 'toolStripMenuItemTreemapTextOptionsOptions + ' + Me.toolStripMenuItemTreemapTextOptionsOptions.Name = "toolStripMenuItemTreemapTextOptionsOptions" + Me.toolStripMenuItemTreemapTextOptionsOptions.Size = New System.Drawing.Size(188, 22) + Me.toolStripMenuItemTreemapTextOptionsOptions.Text = "Treemap Text Options" + ' 'toolStripMenuItemWordcloudOptions ' Me.toolStripMenuItemWordcloudOptions.Name = "toolStripMenuItemWordcloudOptions" @@ -576,7 +587,7 @@ Partial Class dlgBarAndPieChart 'ucrSaveBar ' Me.ucrSaveBar.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveBar.Location = New System.Drawing.Point(10, 461) + Me.ucrSaveBar.Location = New System.Drawing.Point(10, 512) Me.ucrSaveBar.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrSaveBar.Name = "ucrSaveBar" Me.ucrSaveBar.Size = New System.Drawing.Size(372, 24) @@ -611,7 +622,7 @@ Partial Class dlgBarAndPieChart ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(7, 491) + Me.ucrBase.Location = New System.Drawing.Point(7, 542) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 60 @@ -863,18 +874,72 @@ Partial Class dlgBarAndPieChart Me.ucrChkIncreaseSize.Size = New System.Drawing.Size(88, 23) Me.ucrChkIncreaseSize.TabIndex = 63 ' - 'toolStripMenuItemTreemapTextOptionsOptions - ' - Me.toolStripMenuItemTreemapTextOptionsOptions.Name = "toolStripMenuItemTreemapTextOptionsOptions" - Me.toolStripMenuItemTreemapTextOptionsOptions.Size = New System.Drawing.Size(188, 22) - Me.toolStripMenuItemTreemapTextOptionsOptions.Text = "Treemap Text Options" + 'ucrInputStation + ' + Me.ucrInputStation.AddQuotesIfUnrecognised = True + Me.ucrInputStation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputStation.GetSetSelectedIndex = -1 + Me.ucrInputStation.IsReadOnly = False + Me.ucrInputStation.Location = New System.Drawing.Point(327, 478) + Me.ucrInputStation.Name = "ucrInputStation" + Me.ucrInputStation.Size = New System.Drawing.Size(86, 21) + Me.ucrInputStation.TabIndex = 71 + ' + 'ucr1stFactorReceiver + ' + Me.ucr1stFactorReceiver.AutoSize = True + Me.ucr1stFactorReceiver.frmParent = Me + Me.ucr1stFactorReceiver.Location = New System.Drawing.Point(214, 479) + Me.ucr1stFactorReceiver.Margin = New System.Windows.Forms.Padding(0) + Me.ucr1stFactorReceiver.Name = "ucr1stFactorReceiver" + Me.ucr1stFactorReceiver.Selector = Nothing + Me.ucr1stFactorReceiver.Size = New System.Drawing.Size(109, 26) + Me.ucr1stFactorReceiver.strNcFilePath = "" + Me.ucr1stFactorReceiver.TabIndex = 70 + Me.ucr1stFactorReceiver.ucrSelector = Nothing + ' + 'lblFacetBy + ' + Me.lblFacetBy.AutoSize = True + Me.lblFacetBy.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFacetBy.Location = New System.Drawing.Point(214, 464) + Me.lblFacetBy.Name = "lblFacetBy" + Me.lblFacetBy.Size = New System.Drawing.Size(52, 13) + Me.lblFacetBy.TabIndex = 69 + Me.lblFacetBy.Tag = "" + Me.lblFacetBy.Text = "Facet By:" + ' + 'ucrInputLegendPosition + ' + Me.ucrInputLegendPosition.AddQuotesIfUnrecognised = True + Me.ucrInputLegendPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLegendPosition.GetSetSelectedIndex = -1 + Me.ucrInputLegendPosition.IsReadOnly = False + Me.ucrInputLegendPosition.Location = New System.Drawing.Point(97, 478) + Me.ucrInputLegendPosition.Name = "ucrInputLegendPosition" + Me.ucrInputLegendPosition.Size = New System.Drawing.Size(112, 21) + Me.ucrInputLegendPosition.TabIndex = 73 + ' + 'ucrChkLegend + ' + Me.ucrChkLegend.AutoSize = True + Me.ucrChkLegend.Checked = False + Me.ucrChkLegend.Location = New System.Drawing.Point(10, 479) + Me.ucrChkLegend.Name = "ucrChkLegend" + Me.ucrChkLegend.Size = New System.Drawing.Size(98, 24) + Me.ucrChkLegend.TabIndex = 72 ' 'dlgBarAndPieChart ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(415, 547) + Me.ClientSize = New System.Drawing.Size(415, 596) + Me.Controls.Add(Me.ucrInputStation) + Me.Controls.Add(Me.ucr1stFactorReceiver) + Me.Controls.Add(Me.lblFacetBy) + Me.Controls.Add(Me.ucrInputLegendPosition) + Me.Controls.Add(Me.ucrChkLegend) Me.Controls.Add(Me.cmdOptions) Me.Controls.Add(Me.ucrChkReorderValue) Me.Controls.Add(Me.ucrChkReorderFrequency) @@ -1024,4 +1089,9 @@ Partial Class dlgBarAndPieChart Friend WithEvents cmdOptions As ucrSplitButton Friend WithEvents toolStripMenuItemLollipopOptions As ToolStripMenuItem Friend WithEvents toolStripMenuItemTreemapTextOptionsOptions As ToolStripMenuItem + Friend WithEvents ucrInputStation As ucrInputComboBox + Friend WithEvents ucr1stFactorReceiver As ucrReceiverSingle + Friend WithEvents lblFacetBy As Label + Friend WithEvents ucrInputLegendPosition As ucrInputComboBox + Friend WithEvents ucrChkLegend As ucrCheck End Class \ No newline at end of file diff --git a/instat/dlgBarAndPieChart.vb b/instat/dlgBarAndPieChart.vb index 75dc081567e..d1ff1e49111 100644 --- a/instat/dlgBarAndPieChart.vb +++ b/instat/dlgBarAndPieChart.vb @@ -76,14 +76,29 @@ Public Class dlgBarAndPieChart Private clsGeomTextWordcloudAesFunction As New RFunction Private clsScaleSizeAreaFunction As New RFunction Private clsDummyFunction As New RFunction + Private clsThemeFunction As New RFunction Private clsPointsFunction As New RFunction Private clsGeomLollipopAesFunction As New RFunction + Private clsFacetFunction As New RFunction + Private clsFacetVariablesOperator As New ROperator + Private clsFacetRowOp As New ROperator + Private clsFacetColOp As New ROperator + Private clsPipeOperator As New ROperator + Private clsGroupByFunction As New RFunction + Private ReadOnly strAscending As String = "Ascending" Private ReadOnly strDescending As String = "Descending" Private ReadOnly strReverse As String = "Reverse" Private ReadOnly strNone As String = "None" + Private ReadOnly strFacetWrap As String = "Facet Wrap" + Private ReadOnly strFacetRow As String = "Facet Row" + Private ReadOnly strFacetCol As String = "Facet Column" + + Private bUpdateComboOptions As Boolean = True + Private bUpdatingParameters As Boolean = False + 'Parameter names for geoms Private strFirstParameterName As String = "geomfunc" Private strStatSummaryParameterName As String = "stat_summary" @@ -117,6 +132,7 @@ Public Class dlgBarAndPieChart Dim dctLayout As New Dictionary(Of String, String) Dim dctStart As New Dictionary(Of String, String) Dim dctPlace As New Dictionary(Of String, String) + Dim dctLegendPosition As New Dictionary(Of String, String) ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrBase.clsRsyntax.iCallType = 3 @@ -359,6 +375,32 @@ Public Class dlgBarAndPieChart ucrInputPlace.SetRDefault(Chr(34) & "middle" & Chr(34)) ucrInputPlace.SetDropDownStyleAsNonEditable() + ucrChkLegend.SetText("Legend:") + ucrChkLegend.AddToLinkedControls({ucrInputLegendPosition}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="None") + ucrInputLegendPosition.SetDropDownStyleAsNonEditable() + ucrInputLegendPosition.SetParameter(New RParameter("legend.position")) + dctLegendPosition.Add("None", Chr(34) & "none" & Chr(34)) + dctLegendPosition.Add("Left", Chr(34) & "left" & Chr(34)) + dctLegendPosition.Add("Right", Chr(34) & "right" & Chr(34)) + dctLegendPosition.Add("Top", Chr(34) & "top" & Chr(34)) + dctLegendPosition.Add("Bottom", Chr(34) & "bottom" & Chr(34)) + ucrInputLegendPosition.SetItems(dctLegendPosition) + ucrChkLegend.AddParameterPresentCondition(True, "legend.position") + ucrChkLegend.AddParameterPresentCondition(False, "legend.position", False) + + ucr1stFactorReceiver.SetParameter(New RParameter("var1")) + ucr1stFactorReceiver.Selector = ucrBarChartSelector + ucr1stFactorReceiver.SetIncludedDataTypes({"factor"}) + ucr1stFactorReceiver.strSelectorHeading = "Factors" + ucr1stFactorReceiver.bWithQuotes = False + ucr1stFactorReceiver.SetParameterIsString() + ucr1stFactorReceiver.SetValuesToIgnore({"."}) + ucr1stFactorReceiver.SetParameterPosition(1) + ucr1stFactorReceiver.SetLinkedDisplayControl(lblFacetBy) + + ucrInputStation.SetItems({strFacetWrap, strFacetRow, strFacetCol, strNone}) + ucrInputStation.SetDropDownStyleAsNonEditable() + ucrNudMaxSize.SetParameter(New RParameter("max_size", 0)) ucrChkIncreaseSize.SetText("Increase size") ucrChkIncreaseSize.AddToLinkedControls(ucrNudMaxSize, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=20) @@ -408,6 +450,15 @@ Public Class dlgBarAndPieChart clsDummyFunction = New RFunction clsPointsFunction = New RFunction clsGeomLollipopAesFunction = New RFunction + clsFacetFunction = New RFunction + clsFacetVariablesOperator = New ROperator + clsFacetRowOp = New ROperator + clsFacetColOp = New ROperator + clsPipeOperator = New ROperator + clsGroupByFunction = New RFunction + + ucrInputStation.SetName(strFacetWrap) + ucrInputStation.bUpdateRCodeFromControl = True ucrBarChartSelector.Reset() ucrBarChartSelector.SetGgplotFunction(clsBaseOperator) @@ -569,6 +620,22 @@ Public Class dlgBarAndPieChart clsScaleSizeAreaFunction.SetPackageName("ggplot2") clsScaleSizeAreaFunction.SetRCommand("scale_size_area") + clsFacetFunction.SetPackageName("ggplot2") + clsFacetRowOp.SetOperation("+") + clsFacetRowOp.bBrackets = False + clsFacetColOp.SetOperation("+") + clsFacetColOp.bBrackets = False + clsFacetVariablesOperator.SetOperation("~") + clsFacetVariablesOperator.bForceIncludeOperation = True + clsFacetVariablesOperator.bBrackets = False + clsFacetFunction.AddParameter("facets", clsROperatorParameter:=clsFacetVariablesOperator, iPosition:=0) + + clsPipeOperator.SetOperation("%>%") + SetPipeAssignTo() + + clsGroupByFunction.SetPackageName("dplyr") + clsGroupByFunction.SetRCommand("group_by") + clsLabsFunction = GgplotDefaults.clsDefaultLabs.Clone() clsXlabFunction = GgplotDefaults.clsXlabTitleFunction.Clone() clsYlabFunction = GgplotDefaults.clsYlabTitleFunction.Clone() @@ -581,6 +648,7 @@ Public Class dlgBarAndPieChart clsXScaleDateFunction = GgplotDefaults.clsXScaleDateFunction.Clone() clsYScaleDateFunction = GgplotDefaults.clsYScaleDateFunction.Clone() clsThemeFuction = GgplotDefaults.clsDefaultThemeFunction.Clone + clsThemeFunction = GgplotDefaults.clsDefaultThemeFunction.Clone() dctThemeFunctions = New Dictionary(Of String, RFunction)(GgplotDefaults.dctThemeFunctions) clsLocalRaesFunction = GgplotDefaults.clsAesFunction.Clone() clsScaleFillViridisFunction = GgplotDefaults.clsScaleFillViridisFunction @@ -630,6 +698,8 @@ Public Class dlgBarAndPieChart ucrChkAddLabelsTreemap.SetRCode(clsBaseOperator, bReset) ucrNudMaxSize.SetRCode(clsScaleSizeAreaFunction, bReset) ucrChkReorderFrequency.SetRCode(clsDummyFunction, bReset) + ucrChkLegend.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True) + ucrInputLegendPosition.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True) If bReset Then ucrChkStart.SetRCode(clsGeomTreemapFunction, bReset) @@ -672,6 +742,18 @@ Public Class dlgBarAndPieChart TestOkEnabled() End Sub + Private Sub AddRemoveTheme() + If clsThemeFunction.iParameterCount > 0 Then + clsBaseOperator.AddParameter("theme", clsRFunctionParameter:=clsThemeFunction, iPosition:=15) + Else + clsBaseOperator.RemoveParameterByName("theme") + End If + End Sub + + Private Sub ucrChkLegend_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLegend.ControlValueChanged, ucrInputLegendPosition.ControlValueChanged + AddRemoveTheme() + End Sub + Private Sub openSdgLayerOptions(clsNewGeomFunc As RFunction, clsNewAesFunction As RFunction) sdgLayerOptions.SetupLayer(clsNewGgPlot:=clsRggplotFunction, clsNewGeomFunc:=clsNewGeomFunc, clsNewGlobalAesFunc:=clsNewAesFunction, clsNewLocalAes:=clsLocalRaesFunction, @@ -1027,6 +1109,167 @@ Public Class dlgBarAndPieChart UpdateParameter() End Sub + Private Sub AutoFacetStation() + Dim ucrCurrentReceiver As ucrReceiver = Nothing + + If ucrBarChartSelector.CurrentReceiver IsNot Nothing Then + ucrCurrentReceiver = ucrBarChartSelector.CurrentReceiver + End If + ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) + If ucrCurrentReceiver IsNot Nothing Then + ucrCurrentReceiver.SetMeAsReceiver() + End If + AddRemoveGroupBy() + End Sub + + Private Sub ucrInput_ControlValueChanged(ucrChangedControl As ucrInputComboBox) Handles ucrInputStation.ControlValueChanged + If Not bUpdateComboOptions Then + Exit Sub + End If + Dim strChangedText As String = ucrChangedControl.GetText() + If strChangedText <> strNone Then + If Not strChangedText = strFacetCol AndAlso Not strChangedText = strFacetRow AndAlso + Not ucrInputStation.Equals(ucrChangedControl) AndAlso ucrInputStation.GetText() = strChangedText Then + bUpdateComboOptions = False + ucrInputStation.SetName(strNone) + bUpdateComboOptions = True + End If + If (strChangedText = strFacetWrap AndAlso ucrInputStation.GetText = strFacetRow) OrElse (strChangedText = strFacetRow AndAlso + ucrInputStation.GetText = strFacetWrap) OrElse (strChangedText = strFacetWrap AndAlso + ucrInputStation.GetText = strFacetCol) OrElse (strChangedText = strFacetCol AndAlso ucrInputStation.GetText = strFacetWrap) Then + ucrInputStation.SetName(strNone) + End If + End If + UpdateParameters() + AddRemoveFacets() + AddRemoveGroupBy() + End Sub + + Private Sub UpdateParameters() + clsFacetVariablesOperator.RemoveParameterByName("var1") + clsFacetColOp.RemoveParameterByName("col" & ucrInputStation.Name) + clsFacetRowOp.RemoveParameterByName("row" & ucrInputStation.Name) + + clsBaseOperator.RemoveParameterByName("facets") + bUpdatingParameters = True + ucr1stFactorReceiver.SetRCode(Nothing) + Select Case ucrInputStation.GetText() + Case strFacetWrap + ucr1stFactorReceiver.ChangeParameterName("var1") + ucr1stFactorReceiver.SetRCode(clsFacetVariablesOperator) + Case strFacetCol + ucr1stFactorReceiver.ChangeParameterName("col" & ucrInputStation.Name) + ucr1stFactorReceiver.SetRCode(clsFacetColOp) + Case strFacetRow + ucr1stFactorReceiver.ChangeParameterName("row" & ucrInputStation.Name) + ucr1stFactorReceiver.SetRCode(clsFacetRowOp) + End Select + If Not clsRFacetFunction.ContainsParameter("x") Then + clsRFacetFunction.AddParameter("x", Chr(34) & Chr(34)) + End If + bUpdatingParameters = False + End Sub + + Private Sub AddRemoveFacets() + Dim bWrap As Boolean = False + Dim bCol As Boolean = False + Dim bRow As Boolean = False + + If bUpdatingParameters Then + Exit Sub + End If + + clsBaseOperator.RemoveParameterByName("facets") + If Not ucr1stFactorReceiver.IsEmpty Then + Select Case ucrInputStation.GetText() + Case strFacetWrap + bWrap = True + Case strFacetCol + bCol = True + Case strFacetRow + bRow = True + End Select + End If + + If bWrap OrElse bRow OrElse bCol Then + clsBaseOperator.AddParameter("facets", clsRFunctionParameter:=clsFacetFunction) + End If + If bWrap Then + clsFacetFunction.SetRCommand("facet_wrap") + End If + If bRow OrElse bCol Then + clsFacetFunction.SetRCommand("facet_grid") + End If + If bRow Then + clsFacetVariablesOperator.AddParameter("left", clsROperatorParameter:=clsFacetRowOp, iPosition:=0) + ElseIf bCol AndAlso bWrap = False Then + clsFacetVariablesOperator.AddParameter("left", ".", iPosition:=0) + Else + clsFacetVariablesOperator.RemoveParameterByName("left") + End If + If bCol Then + clsFacetVariablesOperator.AddParameter("right", clsROperatorParameter:=clsFacetColOp, iPosition:=1) + ElseIf bRow AndAlso bWrap = False Then + clsFacetVariablesOperator.AddParameter("right", ".", iPosition:=1) + Else + clsFacetVariablesOperator.RemoveParameterByName("right") + End If + End Sub + + Private Sub ucr1stFactorReceiver_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucr1stFactorReceiver.ControlValueChanged, ucrReceiverX.ControlValueChanged + AddRemoveFacets() + AddRemoveGroupBy() + End Sub + + Private Sub GetParameterValue(clsOperator As ROperator) + Dim i As Integer = 0 + For Each clsTempParam As RParameter In clsOperator.clsParameters + If clsTempParam.strArgumentValue <> "" AndAlso clsTempParam.strArgumentValue <> "." Then + clsGroupByFunction.AddParameter(i, clsTempParam.strArgumentValue, bIncludeArgumentName:=False, iPosition:=i) + i = i + 1 + End If + Next + End Sub + + Private Sub AddRemoveGroupBy() + If clsPipeOperator.ContainsParameter("mutate") Then + clsGroupByFunction.ClearParameters() + If clsBaseOperator.ContainsParameter("facets") Then + Select Case ucrInputStation.GetText() + Case strFacetWrap + GetParameterValue(clsFacetVariablesOperator) + Case strFacetCol + GetParameterValue(clsFacetColOp) + Case strFacetRow + GetParameterValue(clsFacetRowOp) + End Select + End If + + If clsGroupByFunction.iParameterCount > 0 Then + clsPipeOperator.AddParameter("group_by", clsRFunctionParameter:=clsGroupByFunction, iPosition:=1) + Else + clsPipeOperator.RemoveParameterByName("group_by") + End If + Else + clsPipeOperator.RemoveParameterByName("group_by") + End If + + SetPipeAssignTo() + End Sub + + Private Sub SetPipeAssignTo() + If ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" AndAlso clsPipeOperator.clsParameters.Count > 1 Then + clsPipeOperator.SetAssignTo(ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + Else + clsPipeOperator.RemoveAssignTo() + End If + End Sub + + Private Sub ucrBarChartSelector_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrBarChartSelector.ControlValueChanged + AutoFacetStation() + SetPipeAssignTo() + End Sub + Private Sub ucrPnlOptions_ControlValueChanged() Handles ucrPnlOptions.ControlValueChanged, ucrVariablesAsFactorForBarChart.ControlValueChanged, ucrReceiverX.ControlValueChanged, ucrReceiverByFactor.ControlValueChanged, ucrReceiverLabel.ControlValueChanged, ucrChkAddLabelsText.ControlValueChanged, ucrChkReorderValue.ControlValueChanged, ucrInputReorderX.ControlValueChanged, diff --git a/instat/dlgHistogram.designer.vb b/instat/dlgHistogram.designer.vb index 46b7178c5f8..734dab62ee1 100644 --- a/instat/dlgHistogram.designer.vb +++ b/instat/dlgHistogram.designer.vb @@ -64,6 +64,11 @@ Partial Class dlgHistogram Me.ucrPnlOptions = New instat.UcrPanel() Me.lblReorder = New System.Windows.Forms.Label() Me.ucrInputAddReorder = New instat.ucrInputComboBox() + Me.ucrInputStation = New instat.ucrInputComboBox() + Me.ucr1stFactorReceiver = New instat.ucrReceiverSingle() + Me.lblFacetBy = New System.Windows.Forms.Label() + Me.ucrInputLegendPosition = New instat.ucrInputComboBox() + Me.ucrChkLegend = New instat.ucrCheck() Me.contextMenuStripOptions.SuspendLayout() Me.SuspendLayout() ' @@ -236,7 +241,7 @@ Partial Class dlgHistogram 'ucrSaveHist ' Me.ucrSaveHist.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveHist.Location = New System.Drawing.Point(10, 342) + Me.ucrSaveHist.Location = New System.Drawing.Point(10, 385) Me.ucrSaveHist.Margin = New System.Windows.Forms.Padding(5) Me.ucrSaveHist.Name = "ucrSaveHist" Me.ucrSaveHist.Size = New System.Drawing.Size(322, 24) @@ -285,7 +290,7 @@ Partial Class dlgHistogram ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 365) + Me.ucrBase.Location = New System.Drawing.Point(10, 408) Me.ucrBase.Margin = New System.Windows.Forms.Padding(4) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(408, 52) @@ -321,12 +326,72 @@ Partial Class dlgHistogram Me.ucrInputAddReorder.Size = New System.Drawing.Size(120, 21) Me.ucrInputAddReorder.TabIndex = 39 ' + 'ucrInputStation + ' + Me.ucrInputStation.AddQuotesIfUnrecognised = True + Me.ucrInputStation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputStation.GetSetSelectedIndex = -1 + Me.ucrInputStation.IsReadOnly = False + Me.ucrInputStation.Location = New System.Drawing.Point(318, 348) + Me.ucrInputStation.Name = "ucrInputStation" + Me.ucrInputStation.Size = New System.Drawing.Size(101, 21) + Me.ucrInputStation.TabIndex = 86 + ' + 'ucr1stFactorReceiver + ' + Me.ucr1stFactorReceiver.AutoSize = True + Me.ucr1stFactorReceiver.frmParent = Me + Me.ucr1stFactorReceiver.Location = New System.Drawing.Point(205, 349) + Me.ucr1stFactorReceiver.Margin = New System.Windows.Forms.Padding(0) + Me.ucr1stFactorReceiver.Name = "ucr1stFactorReceiver" + Me.ucr1stFactorReceiver.Selector = Nothing + Me.ucr1stFactorReceiver.Size = New System.Drawing.Size(110, 26) + Me.ucr1stFactorReceiver.strNcFilePath = "" + Me.ucr1stFactorReceiver.TabIndex = 85 + Me.ucr1stFactorReceiver.ucrSelector = Nothing + ' + 'lblFacetBy + ' + Me.lblFacetBy.AutoSize = True + Me.lblFacetBy.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFacetBy.Location = New System.Drawing.Point(208, 334) + Me.lblFacetBy.Name = "lblFacetBy" + Me.lblFacetBy.Size = New System.Drawing.Size(52, 13) + Me.lblFacetBy.TabIndex = 84 + Me.lblFacetBy.Tag = "" + Me.lblFacetBy.Text = "Facet By:" + ' + 'ucrInputLegendPosition + ' + Me.ucrInputLegendPosition.AddQuotesIfUnrecognised = True + Me.ucrInputLegendPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLegendPosition.GetSetSelectedIndex = -1 + Me.ucrInputLegendPosition.IsReadOnly = False + Me.ucrInputLegendPosition.Location = New System.Drawing.Point(87, 348) + Me.ucrInputLegendPosition.Name = "ucrInputLegendPosition" + Me.ucrInputLegendPosition.Size = New System.Drawing.Size(112, 21) + Me.ucrInputLegendPosition.TabIndex = 88 + ' + 'ucrChkLegend + ' + Me.ucrChkLegend.AutoSize = True + Me.ucrChkLegend.Checked = False + Me.ucrChkLegend.Location = New System.Drawing.Point(11, 349) + Me.ucrChkLegend.Name = "ucrChkLegend" + Me.ucrChkLegend.Size = New System.Drawing.Size(98, 24) + Me.ucrChkLegend.TabIndex = 87 + ' 'dlgHistogram ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(448, 422) + Me.ClientSize = New System.Drawing.Size(448, 461) + Me.Controls.Add(Me.ucrInputStation) + Me.Controls.Add(Me.ucr1stFactorReceiver) + Me.Controls.Add(Me.lblFacetBy) + Me.Controls.Add(Me.ucrInputLegendPosition) + Me.Controls.Add(Me.ucrChkLegend) Me.Controls.Add(Me.lblReorder) Me.Controls.Add(Me.ucrInputAddReorder) Me.Controls.Add(Me.cmdOptions) @@ -382,4 +447,9 @@ Partial Class dlgHistogram Friend WithEvents toolStripMenuItemDotOptions As ToolStripMenuItem Friend WithEvents lblReorder As Label Friend WithEvents ucrInputAddReorder As ucrInputComboBox + Friend WithEvents ucrInputStation As ucrInputComboBox + Friend WithEvents ucr1stFactorReceiver As ucrReceiverSingle + Friend WithEvents lblFacetBy As Label + Friend WithEvents ucrInputLegendPosition As ucrInputComboBox + Friend WithEvents ucrChkLegend As ucrCheck End Class \ No newline at end of file diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 850fb1e5099..3fc31cd62f5 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -47,6 +47,20 @@ Public Class dlgHistogram Private clsForecatsInfreqValue As New RFunction Private clsForecatsReverseValue As New RFunction + Private clsFacetFunction As New RFunction + Private clsFacetVariablesOperator As New ROperator + Private clsFacetRowOp As New ROperator + Private clsFacetColOp As New ROperator + Private clsPipeOperator As New ROperator + Private clsGroupByFunction As New RFunction + + Private ReadOnly strFacetWrap As String = "Facet Wrap" + Private ReadOnly strFacetRow As String = "Facet Row" + Private ReadOnly strFacetCol As String = "Facet Column" + + Private bUpdateComboOptions As Boolean = True + Private bUpdatingParameters As Boolean = False + Private ReadOnly strAscending As String = "Ascending" Private ReadOnly strDescending As String = "Descending" Private ReadOnly strReverse As String = "Reverse" @@ -75,6 +89,7 @@ Public Class dlgHistogram Private Sub InitialiseDialog() Dim dctStats As New Dictionary(Of String, String) + Dim dctLegendPosition As New Dictionary(Of String, String) ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrBase.clsRsyntax.iCallType = 3 ucrBase.iHelpTopicID = 435 @@ -131,6 +146,32 @@ Public Class dlgHistogram ucrInputAddReorder.SetDropDownStyleAsNonEditable() ucrInputAddReorder.SetLinkedDisplayControl(lblReorder) + ucrChkLegend.SetText("Legend:") + ucrChkLegend.AddToLinkedControls({ucrInputLegendPosition}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="None") + ucrInputLegendPosition.SetDropDownStyleAsNonEditable() + ucrInputLegendPosition.SetParameter(New RParameter("legend.position")) + dctLegendPosition.Add("None", Chr(34) & "none" & Chr(34)) + dctLegendPosition.Add("Left", Chr(34) & "left" & Chr(34)) + dctLegendPosition.Add("Right", Chr(34) & "right" & Chr(34)) + dctLegendPosition.Add("Top", Chr(34) & "top" & Chr(34)) + dctLegendPosition.Add("Bottom", Chr(34) & "bottom" & Chr(34)) + ucrInputLegendPosition.SetItems(dctLegendPosition) + ucrChkLegend.AddParameterPresentCondition(True, "legend.position") + ucrChkLegend.AddParameterPresentCondition(False, "legend.position", False) + + ucr1stFactorReceiver.SetParameter(New RParameter("var1")) + ucr1stFactorReceiver.Selector = ucrHistogramSelector + ucr1stFactorReceiver.SetIncludedDataTypes({"factor"}) + ucr1stFactorReceiver.strSelectorHeading = "Factors" + ucr1stFactorReceiver.bWithQuotes = False + ucr1stFactorReceiver.SetParameterIsString() + ucr1stFactorReceiver.SetValuesToIgnore({"."}) + ucr1stFactorReceiver.SetParameterPosition(1) + ucr1stFactorReceiver.SetLinkedDisplayControl(lblFacetBy) + + ucrInputStation.SetItems({strFacetWrap, strFacetRow, strFacetCol, strNone}) + ucrInputStation.SetDropDownStyleAsNonEditable() + ucrPnlOptions.AddToLinkedControls({ucrChkDisplayAsDotPlot}, {rdoHistogram}, bNewLinkedHideIfParameterMissing:=True) ucrPnlOptions.AddToLinkedControls({ucrChkRidges}, {rdoDensity_ridges}, bNewLinkedHideIfParameterMissing:=True) ucrChkRidges.AddToLinkedControls(ucrInputStats, {"FALSE"}, bNewLinkedHideIfParameterMissing:=True) @@ -154,6 +195,15 @@ Public Class dlgHistogram clsForecatsReverse = New RFunction clsForecatsInfreqValue = New RFunction clsForecatsReverseValue = New RFunction + clsFacetFunction = New RFunction + clsFacetVariablesOperator = New ROperator + clsFacetRowOp = New ROperator + clsFacetColOp = New ROperator + clsPipeOperator = New ROperator + clsGroupByFunction = New RFunction + + ucrInputStation.SetName(strFacetWrap) + ucrInputStation.bUpdateRCodeFromControl = True ucrHistogramSelector.Reset() ucrHistogramSelector.SetGgplotFunction(clsBaseOperator) ucrSaveHist.Reset() @@ -195,6 +245,22 @@ Public Class dlgHistogram clsForecatsInfreqValue.SetPackageName("forcats") clsForecatsInfreqValue.SetRCommand("fct_infreq") + clsFacetFunction.SetPackageName("ggplot2") + clsFacetRowOp.SetOperation("+") + clsFacetRowOp.bBrackets = False + clsFacetColOp.SetOperation("+") + clsFacetColOp.bBrackets = False + clsFacetVariablesOperator.SetOperation("~") + clsFacetVariablesOperator.bForceIncludeOperation = True + clsFacetVariablesOperator.bBrackets = False + clsFacetFunction.AddParameter("facets", clsROperatorParameter:=clsFacetVariablesOperator, iPosition:=0) + + clsPipeOperator.SetOperation("%>%") + SetPipeAssignTo() + + clsGroupByFunction.SetPackageName("dplyr") + clsGroupByFunction.SetRCommand("group_by") + clsBaseOperator.AddParameter(GgplotDefaults.clsDefaultThemeParameter.Clone()) clsXlabsFunction = GgplotDefaults.clsXlabTitleFunction.Clone() clsYlabFunction = GgplotDefaults.clsYlabTitleFunction.Clone() @@ -226,6 +292,8 @@ Public Class dlgHistogram ucrChkDisplayAsDotPlot.SetRCode(clsRgeomPlotFunction, bReset) ucrChkRidges.SetRCode(clsRgeomPlotFunction, bReset) ucrVariablesAsFactorforHist.SetRCode(clsRaesFunction, bReset) + ucrChkLegend.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True) + ucrInputLegendPosition.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True) If bReset Then ucrInputStats.SetRCode(clsHistAesFunction, bReset) ucrFactorReceiver.SetRCode(clsRaesFunction, bReset) @@ -247,6 +315,18 @@ Public Class dlgHistogram TestOkEnabled() End Sub + Private Sub AddRemoveTheme() + If clsThemeFunction.iParameterCount > 0 Then + clsBaseOperator.AddParameter("theme", clsRFunctionParameter:=clsThemeFunction, iPosition:=15) + Else + clsBaseOperator.RemoveParameterByName("theme") + End If + End Sub + + Private Sub ucrChkLegend_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLegend.ControlValueChanged, ucrInputLegendPosition.ControlValueChanged + AddRemoveTheme() + End Sub + Private Sub SetDialogOptions() clsHistAesFunction.RemoveParameterByName("x") clsHistAesFunction.RemoveParameterByName("y") @@ -452,27 +532,203 @@ Public Class dlgHistogram Private Sub DialogueSize() If rdoHistogram.Checked Then - Me.Size = New Size(464, 409) + Me.Size = New Size(464, 468) Me.lblReorder.Location = New Point(283, 275) Me.ucrInputAddReorder.Location = New Point(283, 289) - Me.ucrSaveHist.Location = New Point(10, 314) - Me.ucrBase.Location = New Point(10, 342) + Me.ucrSaveHist.Location = New Point(10, 360) + Me.ucrChkLegend.Location = New Point(11, 329) + Me.ucrInputStation.Location = New Point(318, 328) + Me.ucrInputLegendPosition.Location = New Point(87, 328) + Me.ucr1stFactorReceiver.Location = New Point(205, 329) + Me.lblFacetBy.Location = New Point(208, 315) + Me.ucrBase.Location = New Point(10, 390) ElseIf rdoDensity_ridges.Checked Then - Me.Size = New Size(464, 461) + Me.Size = New Size(464, 500) Me.lblReorder.Location = New Point(286, 298) Me.ucrInputAddReorder.Location = New Point(287, 314) - Me.ucrSaveHist.Location = New Point(10, 342) - Me.ucrBase.Location = New Point(10, 365) + Me.ucrSaveHist.Location = New Point(10, 380) + Me.ucrBase.Location = New Point(10, 408) + Me.ucrChkLegend.Location = New Point(11, 349) + Me.ucrInputStation.Location = New Point(318, 348) + Me.ucrInputLegendPosition.Location = New Point(87, 348) + Me.ucr1stFactorReceiver.Location = New Point(205, 349) + Me.lblFacetBy.Location = New Point(208, 334) Else - Me.Size = New Size(464, 401) + Me.Size = New Size(464, 440) Me.lblReorder.Location = New Point(283, 250) Me.ucrInputAddReorder.Location = New Point(283, 264) - Me.ucrSaveHist.Location = New Point(10, 288) - Me.ucrBase.Location = New Point(10, 314) + Me.ucrSaveHist.Location = New Point(10, 330) + Me.ucrChkLegend.Location = New Point(11, 296) + Me.ucrInputStation.Location = New Point(318, 294) + Me.ucrInputLegendPosition.Location = New Point(87, 294) + Me.ucr1stFactorReceiver.Location = New Point(205, 296) + Me.lblFacetBy.Location = New Point(208, 283) + Me.ucrBase.Location = New Point(10, 357) + End If + End Sub + + Private Sub AutoFacetStation() + Dim ucrCurrentReceiver As ucrReceiver = Nothing + + If ucrHistogramSelector.CurrentReceiver IsNot Nothing Then + ucrCurrentReceiver = ucrHistogramSelector.CurrentReceiver + End If + ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrHistogramSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) + If ucrCurrentReceiver IsNot Nothing Then + ucrCurrentReceiver.SetMeAsReceiver() + End If + AddRemoveGroupBy() + End Sub + + Private Sub ucrInput_ControlValueChanged(ucrChangedControl As ucrInputComboBox) Handles ucrInputStation.ControlValueChanged + If Not bUpdateComboOptions Then + Exit Sub + End If + Dim strChangedText As String = ucrChangedControl.GetText() + If strChangedText <> strNone Then + If Not strChangedText = strFacetCol AndAlso Not strChangedText = strFacetRow AndAlso + Not ucrInputStation.Equals(ucrChangedControl) AndAlso ucrInputStation.GetText() = strChangedText Then + bUpdateComboOptions = False + ucrInputStation.SetName(strNone) + bUpdateComboOptions = True + End If + If (strChangedText = strFacetWrap AndAlso ucrInputStation.GetText = strFacetRow) OrElse (strChangedText = strFacetRow AndAlso + ucrInputStation.GetText = strFacetWrap) OrElse (strChangedText = strFacetWrap AndAlso + ucrInputStation.GetText = strFacetCol) OrElse (strChangedText = strFacetCol AndAlso ucrInputStation.GetText = strFacetWrap) Then + ucrInputStation.SetName(strNone) + End If End If + UpdateParameters() + AddRemoveFacets() + AddRemoveGroupBy() End Sub + Private Sub UpdateParameters() + clsFacetVariablesOperator.RemoveParameterByName("var1") + clsFacetColOp.RemoveParameterByName("col" & ucrInputStation.Name) + clsFacetRowOp.RemoveParameterByName("row" & ucrInputStation.Name) + + clsBaseOperator.RemoveParameterByName("facets") + bUpdatingParameters = True + ucr1stFactorReceiver.SetRCode(Nothing) + Select Case ucrInputStation.GetText() + Case strFacetWrap + ucr1stFactorReceiver.ChangeParameterName("var1") + ucr1stFactorReceiver.SetRCode(clsFacetVariablesOperator) + Case strFacetCol + ucr1stFactorReceiver.ChangeParameterName("col" & ucrInputStation.Name) + ucr1stFactorReceiver.SetRCode(clsFacetColOp) + Case strFacetRow + ucr1stFactorReceiver.ChangeParameterName("row" & ucrInputStation.Name) + ucr1stFactorReceiver.SetRCode(clsFacetRowOp) + End Select + If Not clsRaesFunction.ContainsParameter("x") Then + clsRaesFunction.AddParameter("x", Chr(34) & Chr(34)) + End If + bUpdatingParameters = False + End Sub + + Private Sub AddRemoveFacets() + Dim bWrap As Boolean = False + Dim bCol As Boolean = False + Dim bRow As Boolean = False + + If bUpdatingParameters Then + Exit Sub + End If + + clsBaseOperator.RemoveParameterByName("facets") + If Not ucr1stFactorReceiver.IsEmpty Then + Select Case ucrInputStation.GetText() + Case strFacetWrap + bWrap = True + Case strFacetCol + bCol = True + Case strFacetRow + bRow = True + End Select + End If + + If bWrap OrElse bRow OrElse bCol Then + clsBaseOperator.AddParameter("facets", clsRFunctionParameter:=clsFacetFunction) + End If + If bWrap Then + clsFacetFunction.SetRCommand("facet_wrap") + End If + If bRow OrElse bCol Then + clsFacetFunction.SetRCommand("facet_grid") + End If + If bRow Then + clsFacetVariablesOperator.AddParameter("left", clsROperatorParameter:=clsFacetRowOp, iPosition:=0) + ElseIf bCol AndAlso bWrap = False Then + clsFacetVariablesOperator.AddParameter("left", ".", iPosition:=0) + Else + clsFacetVariablesOperator.RemoveParameterByName("left") + End If + If bCol Then + clsFacetVariablesOperator.AddParameter("right", clsROperatorParameter:=clsFacetColOp, iPosition:=1) + ElseIf bRow AndAlso bWrap = False Then + clsFacetVariablesOperator.AddParameter("right", ".", iPosition:=1) + Else + clsFacetVariablesOperator.RemoveParameterByName("right") + End If + End Sub + + Private Sub ucr1stFactorReceiver_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucr1stFactorReceiver.ControlValueChanged, ucrVariablesAsFactorforHist.ControlValueChanged + AddRemoveFacets() + AddRemoveGroupBy() + End Sub + + Private Sub GetParameterValue(clsOperator As ROperator) + Dim i As Integer = 0 + For Each clsTempParam As RParameter In clsOperator.clsParameters + If clsTempParam.strArgumentValue <> "" AndAlso clsTempParam.strArgumentValue <> "." Then + clsGroupByFunction.AddParameter(i, clsTempParam.strArgumentValue, bIncludeArgumentName:=False, iPosition:=i) + i = i + 1 + End If + Next + End Sub + + Private Sub AddRemoveGroupBy() + If clsPipeOperator.ContainsParameter("mutate") Then + clsGroupByFunction.ClearParameters() + If clsBaseOperator.ContainsParameter("facets") Then + Select Case ucrInputStation.GetText() + Case strFacetWrap + GetParameterValue(clsFacetVariablesOperator) + Case strFacetCol + GetParameterValue(clsFacetColOp) + Case strFacetRow + GetParameterValue(clsFacetRowOp) + End Select + End If + + If clsGroupByFunction.iParameterCount > 0 Then + clsPipeOperator.AddParameter("group_by", clsRFunctionParameter:=clsGroupByFunction, iPosition:=1) + Else + clsPipeOperator.RemoveParameterByName("group_by") + End If + Else + clsPipeOperator.RemoveParameterByName("group_by") + End If + + SetPipeAssignTo() + End Sub + + Private Sub SetPipeAssignTo() + If ucrHistogramSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" AndAlso clsPipeOperator.clsParameters.Count > 1 Then + clsPipeOperator.SetAssignTo(ucrHistogramSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + Else + clsPipeOperator.RemoveAssignTo() + End If + End Sub + + Private Sub ucrHistogramSelector_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrHistogramSelector.ControlValueChanged + AutoFacetStation() + SetPipeAssignTo() + End Sub Private Sub CoreControls_ControlContentsChanged() Handles ucrVariablesAsFactorforHist.ControlContentsChanged, ucrSaveHist.ControlContentsChanged, ucrFactorReceiver.ControlContentsChanged, ucrChkRidges.ControlContentsChanged, ucrInputAddReorder.ControlContentsChanged TestOkEnabled() End Sub + End Class \ No newline at end of file diff --git a/instat/dlgLinePlot.designer.vb b/instat/dlgLinePlot.designer.vb index 7e93036b5fc..e265e1421d0 100644 --- a/instat/dlgLinePlot.designer.vb +++ b/instat/dlgLinePlot.designer.vb @@ -49,6 +49,13 @@ Partial Class dlgLinePlot Me.lblMethod = New System.Windows.Forms.Label() Me.lblFamily = New System.Windows.Forms.Label() Me.grpSmoothOptions = New System.Windows.Forms.GroupBox() + Me.ucrInputFormula = New instat.ucrInputComboBox() + Me.ucrChkSpan = New instat.ucrCheck() + Me.ucrChkFormula = New instat.ucrCheck() + Me.ucrChkAddSE = New instat.ucrCheck() + Me.ucrNudSpan = New instat.ucrNud() + Me.ucrInputMethod = New instat.ucrInputComboBox() + Me.ucrFamilyInput = New instat.ucrInputComboBox() Me.rdoRibbon = New System.Windows.Forms.RadioButton() Me.rdoPointrange = New System.Windows.Forms.RadioButton() Me.rdoErrorbar = New System.Windows.Forms.RadioButton() @@ -74,11 +81,16 @@ Partial Class dlgLinePlot Me.lblSlopeLineTicknes = New System.Windows.Forms.Label() Me.contextMenuStripOptions = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.PlotOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.AreaOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.CrossbarOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.DumbbellOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.ErrorbarOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.LineOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.LinerangeOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.PathOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.AreaOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.PointOptionToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.PointrangeOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.RibbonOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.SmoothOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.StepOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.rdoDumbbell = New System.Windows.Forms.RadioButton() @@ -128,20 +140,13 @@ Partial Class dlgLinePlot Me.ucrReceiverXEnd = New instat.ucrReceiverSingle() Me.ucrReceiverSlopeColour = New instat.ucrReceiverSingle() Me.ucrReceiverSlopeX = New instat.ucrReceiverSingle() - Me.ucrInputFormula = New instat.ucrInputComboBox() - Me.ucrChkSpan = New instat.ucrCheck() - Me.ucrChkFormula = New instat.ucrCheck() - Me.ucrChkAddSE = New instat.ucrCheck() - Me.ucrNudSpan = New instat.ucrNud() - Me.ucrInputMethod = New instat.ucrInputComboBox() - Me.ucrFamilyInput = New instat.ucrInputComboBox() Me.ucrPnlStepOrPath = New instat.UcrPanel() Me.ucrPnlLinerangeOptions = New instat.UcrPanel() - Me.LinerangeOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.CrossbarOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.ErrorbarOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.RibbonOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.PointrangeOptionsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.ucrInputStation = New instat.ucrInputComboBox() + Me.ucr1stFactorReceiver = New instat.ucrReceiverSingle() + Me.lblFacetBy = New System.Windows.Forms.Label() + Me.ucrInputLegendPosition = New instat.ucrInputComboBox() + Me.ucrChkLegend = New instat.ucrCheck() Me.grpSmoothOptions.SuspendLayout() Me.contextMenuStripOptions.SuspendLayout() Me.SuspendLayout() @@ -277,6 +282,79 @@ Partial Class dlgLinePlot Me.grpSmoothOptions.TabStop = False Me.grpSmoothOptions.Text = "Smooth Options" ' + 'ucrInputFormula + ' + Me.ucrInputFormula.AddQuotesIfUnrecognised = True + Me.ucrInputFormula.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputFormula.GetSetSelectedIndex = -1 + Me.ucrInputFormula.IsReadOnly = False + Me.ucrInputFormula.Location = New System.Drawing.Point(73, 46) + Me.ucrInputFormula.Name = "ucrInputFormula" + Me.ucrInputFormula.Size = New System.Drawing.Size(110, 23) + Me.ucrInputFormula.TabIndex = 7 + ' + 'ucrChkSpan + ' + Me.ucrChkSpan.AutoSize = True + Me.ucrChkSpan.Checked = False + Me.ucrChkSpan.Location = New System.Drawing.Point(185, 20) + Me.ucrChkSpan.Name = "ucrChkSpan" + Me.ucrChkSpan.Size = New System.Drawing.Size(54, 23) + Me.ucrChkSpan.TabIndex = 4 + ' + 'ucrChkFormula + ' + Me.ucrChkFormula.AutoSize = True + Me.ucrChkFormula.Checked = False + Me.ucrChkFormula.Location = New System.Drawing.Point(5, 49) + Me.ucrChkFormula.Name = "ucrChkFormula" + Me.ucrChkFormula.Size = New System.Drawing.Size(66, 23) + Me.ucrChkFormula.TabIndex = 1 + ' + 'ucrChkAddSE + ' + Me.ucrChkAddSE.AutoSize = True + Me.ucrChkAddSE.Checked = False + Me.ucrChkAddSE.Location = New System.Drawing.Point(185, 51) + Me.ucrChkAddSE.Name = "ucrChkAddSE" + Me.ucrChkAddSE.Size = New System.Drawing.Size(82, 23) + Me.ucrChkAddSE.TabIndex = 8 + ' + 'ucrNudSpan + ' + Me.ucrNudSpan.AutoSize = True + Me.ucrNudSpan.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSpan.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudSpan.Location = New System.Drawing.Point(239, 20) + Me.ucrNudSpan.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudSpan.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudSpan.Name = "ucrNudSpan" + Me.ucrNudSpan.Size = New System.Drawing.Size(50, 20) + Me.ucrNudSpan.TabIndex = 6 + Me.ucrNudSpan.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrInputMethod + ' + Me.ucrInputMethod.AddQuotesIfUnrecognised = True + Me.ucrInputMethod.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputMethod.GetSetSelectedIndex = -1 + Me.ucrInputMethod.IsReadOnly = False + Me.ucrInputMethod.Location = New System.Drawing.Point(52, 20) + Me.ucrInputMethod.Name = "ucrInputMethod" + Me.ucrInputMethod.Size = New System.Drawing.Size(90, 21) + Me.ucrInputMethod.TabIndex = 2 + ' + 'ucrFamilyInput + ' + Me.ucrFamilyInput.AddQuotesIfUnrecognised = True + Me.ucrFamilyInput.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrFamilyInput.GetSetSelectedIndex = -1 + Me.ucrFamilyInput.IsReadOnly = False + Me.ucrFamilyInput.Location = New System.Drawing.Point(210, 20) + Me.ucrFamilyInput.Name = "ucrFamilyInput" + Me.ucrFamilyInput.Size = New System.Drawing.Size(110, 24) + Me.ucrFamilyInput.TabIndex = 5 + ' 'rdoRibbon ' Me.rdoRibbon.AutoSize = True @@ -532,54 +610,84 @@ Partial Class dlgLinePlot ' Me.contextMenuStripOptions.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.PlotOptionsToolStripMenuItem, Me.AreaOptionsToolStripMenuItem, Me.CrossbarOptionsToolStripMenuItem, Me.DumbbellOptionsToolStripMenuItem, Me.ErrorbarOptionsToolStripMenuItem, Me.LineOptionsToolStripMenuItem, Me.LinerangeOptionsToolStripMenuItem, Me.PathOptionsToolStripMenuItem, Me.PointOptionToolStripMenuItem, Me.PointrangeOptionsToolStripMenuItem, Me.RibbonOptionsToolStripMenuItem, Me.SmoothOptionsToolStripMenuItem, Me.StepOptionsToolStripMenuItem}) Me.contextMenuStripOptions.Name = "contextMenuStripOk" - Me.contextMenuStripOptions.Size = New System.Drawing.Size(181, 312) + Me.contextMenuStripOptions.Size = New System.Drawing.Size(178, 290) ' 'PlotOptionsToolStripMenuItem ' Me.PlotOptionsToolStripMenuItem.Name = "PlotOptionsToolStripMenuItem" - Me.PlotOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.PlotOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) Me.PlotOptionsToolStripMenuItem.Text = "Plot Options" ' + 'AreaOptionsToolStripMenuItem + ' + Me.AreaOptionsToolStripMenuItem.Name = "AreaOptionsToolStripMenuItem" + Me.AreaOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) + Me.AreaOptionsToolStripMenuItem.Text = "Area Options" + ' + 'CrossbarOptionsToolStripMenuItem + ' + Me.CrossbarOptionsToolStripMenuItem.Name = "CrossbarOptionsToolStripMenuItem" + Me.CrossbarOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) + Me.CrossbarOptionsToolStripMenuItem.Text = "Crossbar Options" + ' 'DumbbellOptionsToolStripMenuItem ' Me.DumbbellOptionsToolStripMenuItem.Name = "DumbbellOptionsToolStripMenuItem" - Me.DumbbellOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.DumbbellOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) Me.DumbbellOptionsToolStripMenuItem.Text = "Dumbbell Options" ' + 'ErrorbarOptionsToolStripMenuItem + ' + Me.ErrorbarOptionsToolStripMenuItem.Name = "ErrorbarOptionsToolStripMenuItem" + Me.ErrorbarOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) + Me.ErrorbarOptionsToolStripMenuItem.Text = "Errorbar Options" + ' 'LineOptionsToolStripMenuItem ' Me.LineOptionsToolStripMenuItem.Name = "LineOptionsToolStripMenuItem" - Me.LineOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.LineOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) Me.LineOptionsToolStripMenuItem.Text = "Line Options" ' + 'LinerangeOptionsToolStripMenuItem + ' + Me.LinerangeOptionsToolStripMenuItem.Name = "LinerangeOptionsToolStripMenuItem" + Me.LinerangeOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) + Me.LinerangeOptionsToolStripMenuItem.Text = "Linerange Options" + ' 'PathOptionsToolStripMenuItem ' Me.PathOptionsToolStripMenuItem.Name = "PathOptionsToolStripMenuItem" - Me.PathOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.PathOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) Me.PathOptionsToolStripMenuItem.Text = "Path Options " ' - 'AreaOptionsToolStripMenuItem - ' - Me.AreaOptionsToolStripMenuItem.Name = "AreaOptionsToolStripMenuItem" - Me.AreaOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) - Me.AreaOptionsToolStripMenuItem.Text = "Area Options" - ' 'PointOptionToolStripMenuItem ' Me.PointOptionToolStripMenuItem.Name = "PointOptionToolStripMenuItem" - Me.PointOptionToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.PointOptionToolStripMenuItem.Size = New System.Drawing.Size(177, 22) Me.PointOptionToolStripMenuItem.Text = "Point Options " ' + 'PointrangeOptionsToolStripMenuItem + ' + Me.PointrangeOptionsToolStripMenuItem.Name = "PointrangeOptionsToolStripMenuItem" + Me.PointrangeOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) + Me.PointrangeOptionsToolStripMenuItem.Text = "Pointrange Options" + ' + 'RibbonOptionsToolStripMenuItem + ' + Me.RibbonOptionsToolStripMenuItem.Name = "RibbonOptionsToolStripMenuItem" + Me.RibbonOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) + Me.RibbonOptionsToolStripMenuItem.Text = "Ribbon Options" + ' 'SmoothOptionsToolStripMenuItem ' Me.SmoothOptionsToolStripMenuItem.Name = "SmoothOptionsToolStripMenuItem" - Me.SmoothOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.SmoothOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) Me.SmoothOptionsToolStripMenuItem.Text = "Smooth Options" ' 'StepOptionsToolStripMenuItem ' Me.StepOptionsToolStripMenuItem.Name = "StepOptionsToolStripMenuItem" - Me.StepOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) + Me.StepOptionsToolStripMenuItem.Size = New System.Drawing.Size(177, 22) Me.StepOptionsToolStripMenuItem.Text = "Step Options" ' 'rdoDumbbell @@ -876,7 +984,7 @@ Partial Class dlgLinePlot 'ucrSave ' Me.ucrSave.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSave.Location = New System.Drawing.Point(9, 442) + Me.ucrSave.Location = New System.Drawing.Point(9, 482) Me.ucrSave.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrSave.Name = "ucrSave" Me.ucrSave.Size = New System.Drawing.Size(401, 24) @@ -911,7 +1019,7 @@ Partial Class dlgLinePlot ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(9, 467) + Me.ucrBase.Location = New System.Drawing.Point(9, 507) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 68 @@ -1124,79 +1232,6 @@ Partial Class dlgLinePlot Me.ucrReceiverSlopeX.TabIndex = 17 Me.ucrReceiverSlopeX.ucrSelector = Nothing ' - 'ucrInputFormula - ' - Me.ucrInputFormula.AddQuotesIfUnrecognised = True - Me.ucrInputFormula.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputFormula.GetSetSelectedIndex = -1 - Me.ucrInputFormula.IsReadOnly = False - Me.ucrInputFormula.Location = New System.Drawing.Point(73, 46) - Me.ucrInputFormula.Name = "ucrInputFormula" - Me.ucrInputFormula.Size = New System.Drawing.Size(110, 23) - Me.ucrInputFormula.TabIndex = 7 - ' - 'ucrChkSpan - ' - Me.ucrChkSpan.AutoSize = True - Me.ucrChkSpan.Checked = False - Me.ucrChkSpan.Location = New System.Drawing.Point(185, 20) - Me.ucrChkSpan.Name = "ucrChkSpan" - Me.ucrChkSpan.Size = New System.Drawing.Size(54, 23) - Me.ucrChkSpan.TabIndex = 4 - ' - 'ucrChkFormula - ' - Me.ucrChkFormula.AutoSize = True - Me.ucrChkFormula.Checked = False - Me.ucrChkFormula.Location = New System.Drawing.Point(5, 49) - Me.ucrChkFormula.Name = "ucrChkFormula" - Me.ucrChkFormula.Size = New System.Drawing.Size(66, 23) - Me.ucrChkFormula.TabIndex = 1 - ' - 'ucrChkAddSE - ' - Me.ucrChkAddSE.AutoSize = True - Me.ucrChkAddSE.Checked = False - Me.ucrChkAddSE.Location = New System.Drawing.Point(185, 51) - Me.ucrChkAddSE.Name = "ucrChkAddSE" - Me.ucrChkAddSE.Size = New System.Drawing.Size(82, 23) - Me.ucrChkAddSE.TabIndex = 8 - ' - 'ucrNudSpan - ' - Me.ucrNudSpan.AutoSize = True - Me.ucrNudSpan.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSpan.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudSpan.Location = New System.Drawing.Point(239, 20) - Me.ucrNudSpan.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudSpan.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudSpan.Name = "ucrNudSpan" - Me.ucrNudSpan.Size = New System.Drawing.Size(50, 20) - Me.ucrNudSpan.TabIndex = 6 - Me.ucrNudSpan.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrInputMethod - ' - Me.ucrInputMethod.AddQuotesIfUnrecognised = True - Me.ucrInputMethod.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputMethod.GetSetSelectedIndex = -1 - Me.ucrInputMethod.IsReadOnly = False - Me.ucrInputMethod.Location = New System.Drawing.Point(52, 20) - Me.ucrInputMethod.Name = "ucrInputMethod" - Me.ucrInputMethod.Size = New System.Drawing.Size(90, 21) - Me.ucrInputMethod.TabIndex = 2 - ' - 'ucrFamilyInput - ' - Me.ucrFamilyInput.AddQuotesIfUnrecognised = True - Me.ucrFamilyInput.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrFamilyInput.GetSetSelectedIndex = -1 - Me.ucrFamilyInput.IsReadOnly = False - Me.ucrFamilyInput.Location = New System.Drawing.Point(210, 20) - Me.ucrFamilyInput.Name = "ucrFamilyInput" - Me.ucrFamilyInput.Size = New System.Drawing.Size(110, 24) - Me.ucrFamilyInput.TabIndex = 5 - ' 'ucrPnlStepOrPath ' Me.ucrPnlStepOrPath.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink @@ -1213,41 +1248,71 @@ Partial Class dlgLinePlot Me.ucrPnlLinerangeOptions.Size = New System.Drawing.Size(385, 33) Me.ucrPnlLinerangeOptions.TabIndex = 2 ' - 'LinerangeOptionsToolStripMenuItem - ' - Me.LinerangeOptionsToolStripMenuItem.Name = "LinerangeOptionsToolStripMenuItem" - Me.LinerangeOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) - Me.LinerangeOptionsToolStripMenuItem.Text = "Linerange Options" - ' - 'CrossbarOptionsToolStripMenuItem - ' - Me.CrossbarOptionsToolStripMenuItem.Name = "CrossbarOptionsToolStripMenuItem" - Me.CrossbarOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) - Me.CrossbarOptionsToolStripMenuItem.Text = "Crossbar Options" - ' - 'ErrorbarOptionsToolStripMenuItem - ' - Me.ErrorbarOptionsToolStripMenuItem.Name = "ErrorbarOptionsToolStripMenuItem" - Me.ErrorbarOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) - Me.ErrorbarOptionsToolStripMenuItem.Text = "Errorbar Options" - ' - 'RibbonOptionsToolStripMenuItem - ' - Me.RibbonOptionsToolStripMenuItem.Name = "RibbonOptionsToolStripMenuItem" - Me.RibbonOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) - Me.RibbonOptionsToolStripMenuItem.Text = "Ribbon Options" - ' - 'PointrangeOptionsToolStripMenuItem - ' - Me.PointrangeOptionsToolStripMenuItem.Name = "PointrangeOptionsToolStripMenuItem" - Me.PointrangeOptionsToolStripMenuItem.Size = New System.Drawing.Size(180, 22) - Me.PointrangeOptionsToolStripMenuItem.Text = "Pointrange Options" + 'ucrInputStation + ' + Me.ucrInputStation.AddQuotesIfUnrecognised = True + Me.ucrInputStation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputStation.GetSetSelectedIndex = -1 + Me.ucrInputStation.IsReadOnly = False + Me.ucrInputStation.Location = New System.Drawing.Point(318, 452) + Me.ucrInputStation.Name = "ucrInputStation" + Me.ucrInputStation.Size = New System.Drawing.Size(101, 21) + Me.ucrInputStation.TabIndex = 81 + ' + 'ucr1stFactorReceiver + ' + Me.ucr1stFactorReceiver.AutoSize = True + Me.ucr1stFactorReceiver.frmParent = Me + Me.ucr1stFactorReceiver.Location = New System.Drawing.Point(205, 453) + Me.ucr1stFactorReceiver.Margin = New System.Windows.Forms.Padding(0) + Me.ucr1stFactorReceiver.Name = "ucr1stFactorReceiver" + Me.ucr1stFactorReceiver.Selector = Nothing + Me.ucr1stFactorReceiver.Size = New System.Drawing.Size(110, 26) + Me.ucr1stFactorReceiver.strNcFilePath = "" + Me.ucr1stFactorReceiver.TabIndex = 80 + Me.ucr1stFactorReceiver.ucrSelector = Nothing + ' + 'lblFacetBy + ' + Me.lblFacetBy.AutoSize = True + Me.lblFacetBy.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFacetBy.Location = New System.Drawing.Point(208, 438) + Me.lblFacetBy.Name = "lblFacetBy" + Me.lblFacetBy.Size = New System.Drawing.Size(52, 13) + Me.lblFacetBy.TabIndex = 79 + Me.lblFacetBy.Tag = "" + Me.lblFacetBy.Text = "Facet By:" + ' + 'ucrInputLegendPosition + ' + Me.ucrInputLegendPosition.AddQuotesIfUnrecognised = True + Me.ucrInputLegendPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLegendPosition.GetSetSelectedIndex = -1 + Me.ucrInputLegendPosition.IsReadOnly = False + Me.ucrInputLegendPosition.Location = New System.Drawing.Point(87, 452) + Me.ucrInputLegendPosition.Name = "ucrInputLegendPosition" + Me.ucrInputLegendPosition.Size = New System.Drawing.Size(112, 21) + Me.ucrInputLegendPosition.TabIndex = 83 + ' + 'ucrChkLegend + ' + Me.ucrChkLegend.AutoSize = True + Me.ucrChkLegend.Checked = False + Me.ucrChkLegend.Location = New System.Drawing.Point(11, 453) + Me.ucrChkLegend.Name = "ucrChkLegend" + Me.ucrChkLegend.Size = New System.Drawing.Size(98, 24) + Me.ucrChkLegend.TabIndex = 82 ' 'dlgLinePlot ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi - Me.ClientSize = New System.Drawing.Size(423, 523) + Me.ClientSize = New System.Drawing.Size(423, 563) + Me.Controls.Add(Me.ucrInputStation) + Me.Controls.Add(Me.ucr1stFactorReceiver) + Me.Controls.Add(Me.lblFacetBy) + Me.Controls.Add(Me.ucrInputLegendPosition) + Me.Controls.Add(Me.ucrChkLegend) Me.Controls.Add(Me.rdoArea) Me.Controls.Add(Me.lblGroupLine) Me.Controls.Add(Me.ucrReceiverGroup) @@ -1445,4 +1510,9 @@ Partial Class dlgLinePlot Friend WithEvents LinerangeOptionsToolStripMenuItem As ToolStripMenuItem Friend WithEvents PointrangeOptionsToolStripMenuItem As ToolStripMenuItem Friend WithEvents RibbonOptionsToolStripMenuItem As ToolStripMenuItem + Friend WithEvents ucrInputStation As ucrInputComboBox + Friend WithEvents ucr1stFactorReceiver As ucrReceiverSingle + Friend WithEvents lblFacetBy As Label + Friend WithEvents ucrInputLegendPosition As ucrInputComboBox + Friend WithEvents ucrChkLegend As ucrCheck End Class diff --git a/instat/dlgLinePlot.vb b/instat/dlgLinePlot.vb index 009c05e0d8a..a23719978a3 100644 --- a/instat/dlgLinePlot.vb +++ b/instat/dlgLinePlot.vb @@ -63,6 +63,21 @@ Public Class dlgLinePlot Private clsGeomErrorbarFunction As New RFunction Private clsGeomPointrangeFunction As New RFunction + Private clsFacetFunction As New RFunction + Private clsFacetVariablesOperator As New ROperator + Private clsFacetRowOp As New ROperator + Private clsFacetColOp As New ROperator + Private clsPipeOperator As New ROperator + Private clsGroupByFunction As New RFunction + + Private ReadOnly strNone As String = "None" + Private ReadOnly strFacetWrap As String = "Facet Wrap" + Private ReadOnly strFacetRow As String = "Facet Row" + Private ReadOnly strFacetCol As String = "Facet Column" + + Private bUpdateComboOptions As Boolean = True + Private bUpdatingParameters As Boolean = False + 'Parameter names for geoms Private strFirstParameterName As String = "geomfunc" Private strgeomSmoothParameterName As String = "geom_smooth" @@ -91,6 +106,7 @@ Public Class dlgLinePlot Dim dctFamilyOptions As New Dictionary(Of String, String) Dim dctColourOptions As New Dictionary(Of String, String) Dim dctSlopeLineColourOptions As New Dictionary(Of String, String) + Dim dctLegendPosition As New Dictionary(Of String, String) ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrBase.clsRsyntax.iCallType = 3 @@ -396,6 +412,32 @@ Public Class dlgLinePlot ucrChkSlopeLegend.AddParameterPresentCondition(True, "slopetheme") ucrChkSlopeLegend.AddParameterPresentCondition(False, "slopetheme", False) + ucrChkLegend.SetText("Legend:") + ucrChkLegend.AddToLinkedControls({ucrInputLegendPosition}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="None") + ucrInputLegendPosition.SetDropDownStyleAsNonEditable() + ucrInputLegendPosition.SetParameter(New RParameter("legend.position")) + dctLegendPosition.Add("None", Chr(34) & "none" & Chr(34)) + dctLegendPosition.Add("Left", Chr(34) & "left" & Chr(34)) + dctLegendPosition.Add("Right", Chr(34) & "right" & Chr(34)) + dctLegendPosition.Add("Top", Chr(34) & "top" & Chr(34)) + dctLegendPosition.Add("Bottom", Chr(34) & "bottom" & Chr(34)) + ucrInputLegendPosition.SetItems(dctLegendPosition) + ucrChkLegend.AddParameterPresentCondition(True, "legend.position") + ucrChkLegend.AddParameterPresentCondition(False, "legend.position", False) + + ucr1stFactorReceiver.SetParameter(New RParameter("var1")) + ucr1stFactorReceiver.Selector = ucrLinePlotSelector + ucr1stFactorReceiver.SetIncludedDataTypes({"factor"}) + ucr1stFactorReceiver.strSelectorHeading = "Factors" + ucr1stFactorReceiver.bWithQuotes = False + ucr1stFactorReceiver.SetParameterIsString() + ucr1stFactorReceiver.SetValuesToIgnore({"."}) + ucr1stFactorReceiver.SetParameterPosition(1) + ucr1stFactorReceiver.SetLinkedDisplayControl(lblFacetBy) + + ucrInputStation.SetItems({strFacetWrap, strFacetRow, strFacetCol, strNone}) + ucrInputStation.SetDropDownStyleAsNonEditable() + ucrPnlOptions.AddToLinkedControls({ucrChkPathOrStep, ucrChkWithSE, ucrChkLineofBestFit}, {rdoLine}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlOptions.AddToLinkedControls({ucrChkAddLine, ucrInputMethod, ucrInputFormula}, {rdoSmoothing}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlOptions.AddToLinkedControls({ucrChkAddSE, ucrChkFormula, ucrChkSpan}, {rdoSmoothing}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="FALSE") @@ -475,6 +517,15 @@ Public Class dlgLinePlot clsGeomLinerangeFunction = New RFunction clsGeomPointrangeFunction = New RFunction clsGeomRibbonFunction = New RFunction + clsFacetFunction = New RFunction + clsFacetVariablesOperator = New ROperator + clsFacetRowOp = New ROperator + clsFacetColOp = New ROperator + clsPipeOperator = New ROperator + clsGroupByFunction = New RFunction + + ucrInputStation.SetName(strFacetWrap) + ucrInputStation.bUpdateRCodeFromControl = True ucrLinePlotSelector.Reset() ucrLinePlotSelector.SetGgplotFunction(clsBaseOperator) @@ -513,6 +564,22 @@ Public Class dlgLinePlot clsSlopeThemeFunction.SetRCommand("slopegraph_theme") + clsFacetFunction.SetPackageName("ggplot2") + clsFacetRowOp.SetOperation("+") + clsFacetRowOp.bBrackets = False + clsFacetColOp.SetOperation("+") + clsFacetColOp.bBrackets = False + clsFacetVariablesOperator.SetOperation("~") + clsFacetVariablesOperator.bForceIncludeOperation = True + clsFacetVariablesOperator.bBrackets = False + clsFacetFunction.AddParameter("facets", clsROperatorParameter:=clsFacetVariablesOperator, iPosition:=0) + + clsPipeOperator.SetOperation("%>%") + SetPipeAssignTo() + + clsGroupByFunction.SetPackageName("dplyr") + clsGroupByFunction.SetRCommand("group_by") + clsBaseOperator.AddParameter(GgplotDefaults.clsDefaultThemeParameter.Clone()) clsXlabsFunction = GgplotDefaults.clsXlabTitleFunction.Clone() clsYlabFunction = GgplotDefaults.clsYlabTitleFunction.Clone @@ -615,6 +682,8 @@ Public Class dlgLinePlot ucrChkSlopeLabelOptions.SetRCode(clsGgSlopeFunction, bReset) ucrChkSlopeTextOptions.SetRCode(clsGgSlopeFunction, bReset) ucrChkSlopeLineOptions.SetRCode(clsGgSlopeFunction, bReset) + ucrChkLegend.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True) + ucrInputLegendPosition.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True) If bReset Then ucrChkRibbon.SetRCode(clsOptionsFunction, bReset) End If @@ -818,6 +887,18 @@ Public Class dlgLinePlot End If End Sub + Private Sub AddRemoveTheme() + If clsThemeFunction.iParameterCount > 0 Then + clsBaseOperator.AddParameter("theme", clsRFunctionParameter:=clsThemeFunction, iPosition:=15) + Else + clsBaseOperator.RemoveParameterByName("theme") + End If + End Sub + + Private Sub ucrChkLegend_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLegend.ControlValueChanged, ucrInputLegendPosition.ControlValueChanged + AddRemoveTheme() + End Sub + Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click, PlotOptionsToolStripMenuItem.Click sdgPlots.SetRCode(clsNewOperator:=ucrBase.clsRsyntax.clsBaseOperator, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction, clsNewXLabsTitleFunction:=clsXlabsFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewFacetFunction:=clsRFacetFunction, @@ -877,4 +958,164 @@ Public Class dlgLinePlot openSdgLayerOptions(clsGeomRibbonFunction) End Sub + Private Sub AutoFacetStation() + Dim ucrCurrentReceiver As ucrReceiver = Nothing + + If ucrLinePlotSelector.CurrentReceiver IsNot Nothing Then + ucrCurrentReceiver = ucrLinePlotSelector.CurrentReceiver + End If + ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrLinePlotSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) + If ucrCurrentReceiver IsNot Nothing Then + ucrCurrentReceiver.SetMeAsReceiver() + End If + AddRemoveGroupBy() + End Sub + + Private Sub ucrInput_ControlValueChanged(ucrChangedControl As ucrInputComboBox) Handles ucrInputStation.ControlValueChanged + If Not bUpdateComboOptions Then + Exit Sub + End If + Dim strChangedText As String = ucrChangedControl.GetText() + If strChangedText <> strNone Then + If Not strChangedText = strFacetCol AndAlso Not strChangedText = strFacetRow AndAlso + Not ucrInputStation.Equals(ucrChangedControl) AndAlso ucrInputStation.GetText() = strChangedText Then + bUpdateComboOptions = False + ucrInputStation.SetName(strNone) + bUpdateComboOptions = True + End If + If (strChangedText = strFacetWrap AndAlso ucrInputStation.GetText = strFacetRow) OrElse (strChangedText = strFacetRow AndAlso + ucrInputStation.GetText = strFacetWrap) OrElse (strChangedText = strFacetWrap AndAlso + ucrInputStation.GetText = strFacetCol) OrElse (strChangedText = strFacetCol AndAlso ucrInputStation.GetText = strFacetWrap) Then + ucrInputStation.SetName(strNone) + End If + End If + UpdateParameters() + AddRemoveFacets() + AddRemoveGroupBy() + End Sub + + Private Sub UpdateParameters() + clsFacetVariablesOperator.RemoveParameterByName("var1") + clsFacetColOp.RemoveParameterByName("col" & ucrInputStation.Name) + clsFacetRowOp.RemoveParameterByName("row" & ucrInputStation.Name) + + clsBaseOperator.RemoveParameterByName("facets") + bUpdatingParameters = True + ucr1stFactorReceiver.SetRCode(Nothing) + Select Case ucrInputStation.GetText() + Case strFacetWrap + ucr1stFactorReceiver.ChangeParameterName("var1") + ucr1stFactorReceiver.SetRCode(clsFacetVariablesOperator) + Case strFacetCol + ucr1stFactorReceiver.ChangeParameterName("col" & ucrInputStation.Name) + ucr1stFactorReceiver.SetRCode(clsFacetColOp) + Case strFacetRow + ucr1stFactorReceiver.ChangeParameterName("row" & ucrInputStation.Name) + ucr1stFactorReceiver.SetRCode(clsFacetRowOp) + End Select + If Not clsRaesFunction.ContainsParameter("x") Then + clsRaesFunction.AddParameter("x", Chr(34) & Chr(34)) + End If + bUpdatingParameters = False + End Sub + + Private Sub AddRemoveFacets() + Dim bWrap As Boolean = False + Dim bCol As Boolean = False + Dim bRow As Boolean = False + + If bUpdatingParameters Then + Exit Sub + End If + + clsBaseOperator.RemoveParameterByName("facets") + If Not ucr1stFactorReceiver.IsEmpty Then + Select Case ucrInputStation.GetText() + Case strFacetWrap + bWrap = True + Case strFacetCol + bCol = True + Case strFacetRow + bRow = True + End Select + End If + + If bWrap OrElse bRow OrElse bCol Then + clsBaseOperator.AddParameter("facets", clsRFunctionParameter:=clsFacetFunction) + End If + If bWrap Then + clsFacetFunction.SetRCommand("facet_wrap") + End If + If bRow OrElse bCol Then + clsFacetFunction.SetRCommand("facet_grid") + End If + If bRow Then + clsFacetVariablesOperator.AddParameter("left", clsROperatorParameter:=clsFacetRowOp, iPosition:=0) + ElseIf bCol AndAlso bWrap = False Then + clsFacetVariablesOperator.AddParameter("left", ".", iPosition:=0) + Else + clsFacetVariablesOperator.RemoveParameterByName("left") + End If + If bCol Then + clsFacetVariablesOperator.AddParameter("right", clsROperatorParameter:=clsFacetColOp, iPosition:=1) + ElseIf bRow AndAlso bWrap = False Then + clsFacetVariablesOperator.AddParameter("right", ".", iPosition:=1) + Else + clsFacetVariablesOperator.RemoveParameterByName("right") + End If + End Sub + + Private Sub ucr1stFactorReceiver_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucr1stFactorReceiver.ControlValueChanged, ucrReceiverX.ControlValueChanged + AddRemoveFacets() + AddRemoveGroupBy() + End Sub + + Private Sub GetParameterValue(clsOperator As ROperator) + Dim i As Integer = 0 + For Each clsTempParam As RParameter In clsOperator.clsParameters + If clsTempParam.strArgumentValue <> "" AndAlso clsTempParam.strArgumentValue <> "." Then + clsGroupByFunction.AddParameter(i, clsTempParam.strArgumentValue, bIncludeArgumentName:=False, iPosition:=i) + i = i + 1 + End If + Next + End Sub + + Private Sub AddRemoveGroupBy() + If clsPipeOperator.ContainsParameter("mutate") Then + clsGroupByFunction.ClearParameters() + If clsBaseOperator.ContainsParameter("facets") Then + Select Case ucrInputStation.GetText() + Case strFacetWrap + GetParameterValue(clsFacetVariablesOperator) + Case strFacetCol + GetParameterValue(clsFacetColOp) + Case strFacetRow + GetParameterValue(clsFacetRowOp) + End Select + End If + + If clsGroupByFunction.iParameterCount > 0 Then + clsPipeOperator.AddParameter("group_by", clsRFunctionParameter:=clsGroupByFunction, iPosition:=1) + Else + clsPipeOperator.RemoveParameterByName("group_by") + End If + Else + clsPipeOperator.RemoveParameterByName("group_by") + End If + + SetPipeAssignTo() + End Sub + + Private Sub SetPipeAssignTo() + If ucrLinePlotSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" AndAlso clsPipeOperator.clsParameters.Count > 1 Then + clsPipeOperator.SetAssignTo(ucrLinePlotSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + Else + clsPipeOperator.RemoveAssignTo() + End If + End Sub + + Private Sub ucrLinePlotSelector_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrLinePlotSelector.ControlValueChanged + AutoFacetStation() + SetPipeAssignTo() + End Sub End Class \ No newline at end of file diff --git a/instat/dlgScatterPlot.Designer.vb b/instat/dlgScatterPlot.Designer.vb index a722c9958a4..7da7e411a27 100644 --- a/instat/dlgScatterPlot.Designer.vb +++ b/instat/dlgScatterPlot.Designer.vb @@ -82,6 +82,11 @@ Partial Class dlgScatterPlot Me.ucrFactorOptionalReceiver = New instat.ucrReceiverSingle() Me.ucrReceiverX = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() + Me.ucrInputStation = New instat.ucrInputComboBox() + Me.ucr1stFactorReceiver = New instat.ucrReceiverSingle() + Me.lblFacetBy = New System.Windows.Forms.Label() + Me.ucrInputLegendPosition = New instat.ucrInputComboBox() + Me.ucrChkLegend = New instat.ucrCheck() Me.contextMenuStripOptions.SuspendLayout() Me.grpGeom.SuspendLayout() Me.SuspendLayout() @@ -457,7 +462,7 @@ Partial Class dlgScatterPlot 'ucrSaveScatterPlot ' Me.ucrSaveScatterPlot.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveScatterPlot.Location = New System.Drawing.Point(10, 428) + Me.ucrSaveScatterPlot.Location = New System.Drawing.Point(10, 473) Me.ucrSaveScatterPlot.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrSaveScatterPlot.Name = "ucrSaveScatterPlot" Me.ucrSaveScatterPlot.Size = New System.Drawing.Size(312, 24) @@ -518,17 +523,77 @@ Partial Class dlgScatterPlot ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 459) + Me.ucrBase.Location = New System.Drawing.Point(10, 504) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 17 ' + 'ucrInputStation + ' + Me.ucrInputStation.AddQuotesIfUnrecognised = True + Me.ucrInputStation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputStation.GetSetSelectedIndex = -1 + Me.ucrInputStation.IsReadOnly = False + Me.ucrInputStation.Location = New System.Drawing.Point(339, 440) + Me.ucrInputStation.Name = "ucrInputStation" + Me.ucrInputStation.Size = New System.Drawing.Size(101, 21) + Me.ucrInputStation.TabIndex = 76 + ' + 'ucr1stFactorReceiver + ' + Me.ucr1stFactorReceiver.AutoSize = True + Me.ucr1stFactorReceiver.frmParent = Me + Me.ucr1stFactorReceiver.Location = New System.Drawing.Point(212, 441) + Me.ucr1stFactorReceiver.Margin = New System.Windows.Forms.Padding(0) + Me.ucr1stFactorReceiver.Name = "ucr1stFactorReceiver" + Me.ucr1stFactorReceiver.Selector = Nothing + Me.ucr1stFactorReceiver.Size = New System.Drawing.Size(121, 26) + Me.ucr1stFactorReceiver.strNcFilePath = "" + Me.ucr1stFactorReceiver.TabIndex = 75 + Me.ucr1stFactorReceiver.ucrSelector = Nothing + ' + 'lblFacetBy + ' + Me.lblFacetBy.AutoSize = True + Me.lblFacetBy.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblFacetBy.Location = New System.Drawing.Point(212, 426) + Me.lblFacetBy.Name = "lblFacetBy" + Me.lblFacetBy.Size = New System.Drawing.Size(52, 13) + Me.lblFacetBy.TabIndex = 74 + Me.lblFacetBy.Tag = "" + Me.lblFacetBy.Text = "Facet By:" + ' + 'ucrInputLegendPosition + ' + Me.ucrInputLegendPosition.AddQuotesIfUnrecognised = True + Me.ucrInputLegendPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLegendPosition.GetSetSelectedIndex = -1 + Me.ucrInputLegendPosition.IsReadOnly = False + Me.ucrInputLegendPosition.Location = New System.Drawing.Point(96, 440) + Me.ucrInputLegendPosition.Name = "ucrInputLegendPosition" + Me.ucrInputLegendPosition.Size = New System.Drawing.Size(112, 21) + Me.ucrInputLegendPosition.TabIndex = 78 + ' + 'ucrChkLegend + ' + Me.ucrChkLegend.AutoSize = True + Me.ucrChkLegend.Checked = False + Me.ucrChkLegend.Location = New System.Drawing.Point(10, 441) + Me.ucrChkLegend.Name = "ucrChkLegend" + Me.ucrChkLegend.Size = New System.Drawing.Size(98, 24) + Me.ucrChkLegend.TabIndex = 77 + ' 'dlgScatterPlot ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(483, 521) + Me.ClientSize = New System.Drawing.Size(469, 558) + Me.Controls.Add(Me.ucrInputStation) + Me.Controls.Add(Me.ucr1stFactorReceiver) + Me.Controls.Add(Me.lblFacetBy) + Me.Controls.Add(Me.ucrInputLegendPosition) + Me.Controls.Add(Me.ucrChkLegend) Me.Controls.Add(Me.grpGeom) Me.Controls.Add(Me.cmdOptions) Me.Controls.Add(Me.ucrInputSides) @@ -605,4 +670,9 @@ Partial Class dlgScatterPlot Friend WithEvents lblPosition As Label Friend WithEvents ucrInputLegend As ucrInputComboBox Friend WithEvents lblLegend As Label + Friend WithEvents ucrInputStation As ucrInputComboBox + Friend WithEvents ucr1stFactorReceiver As ucrReceiverSingle + Friend WithEvents lblFacetBy As Label + Friend WithEvents ucrInputLegendPosition As ucrInputComboBox + Friend WithEvents ucrChkLegend As ucrCheck End Class diff --git a/instat/dlgScatterPlot.vb b/instat/dlgScatterPlot.vb index 24238bce012..fc4e930fce1 100644 --- a/instat/dlgScatterPlot.vb +++ b/instat/dlgScatterPlot.vb @@ -44,6 +44,21 @@ Public Class dlgScatterPlot Private clsGeomRugFunction As New RFunction Private clsGeomJitterFunction As New RFunction Private clsCountGeomFunction, clsDummyFunction As New RFunction + + Private clsFacetFunction As New RFunction + Private clsFacetVariablesOperator As New ROperator + Private clsFacetRowOp As New ROperator + Private clsFacetColOp As New ROperator + Private clsPipeOperator As New ROperator + Private clsGroupByFunction As New RFunction + + Private ReadOnly strNone As String = "None" + Private ReadOnly strFacetWrap As String = "Facet Wrap" + Private ReadOnly strFacetRow As String = "Facet Row" + Private ReadOnly strFacetCol As String = "Facet Column" + + Private bUpdateComboOptions As Boolean = True + Private bUpdatingParameters As Boolean = False 'Parameter names for geoms Private strFirstParameterName As String = "geomfunc" Private strGeomSmoothParameterName As String = "geom_smooth" @@ -71,6 +86,7 @@ Public Class dlgScatterPlot Dim dctSidesOptions As New Dictionary(Of String, String) Dim dctShapePoint As New Dictionary(Of String, String) Dim dctPositioncount As New Dictionary(Of String, String) + Dim dctLegendPosition As New Dictionary(Of String, String) ucrBase.iHelpTopicID = 433 ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False @@ -224,6 +240,33 @@ Public Class dlgScatterPlot ucrInputSides.SetRDefault(Chr(34) & "bl" & Chr(34)) ucrInputSides.SetDropDownStyleAsNonEditable() + ucrChkLegend.SetText("Legend:") + ucrChkLegend.AddToLinkedControls({ucrInputLegendPosition}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="None") + ucrInputLegendPosition.SetDropDownStyleAsNonEditable() + ucrInputLegendPosition.SetParameter(New RParameter("legend.position")) + dctLegendPosition.Add("None", Chr(34) & "none" & Chr(34)) + dctLegendPosition.Add("Left", Chr(34) & "left" & Chr(34)) + dctLegendPosition.Add("Right", Chr(34) & "right" & Chr(34)) + dctLegendPosition.Add("Top", Chr(34) & "top" & Chr(34)) + dctLegendPosition.Add("Bottom", Chr(34) & "bottom" & Chr(34)) + ucrInputLegendPosition.SetItems(dctLegendPosition) + ucrChkLegend.AddParameterPresentCondition(True, "legend.position") + ucrChkLegend.AddParameterPresentCondition(False, "legend.position", False) + + ucr1stFactorReceiver.SetParameter(New RParameter("var1")) + ucr1stFactorReceiver.Selector = ucrSelectorForScatter + ucr1stFactorReceiver.SetIncludedDataTypes({"factor"}) + ucr1stFactorReceiver.strSelectorHeading = "Factors" + ucr1stFactorReceiver.bWithQuotes = False + ucr1stFactorReceiver.SetParameterIsString() + ucr1stFactorReceiver.SetValuesToIgnore({"."}) + ucr1stFactorReceiver.SetParameterPosition(1) + ucr1stFactorReceiver.SetLinkedDisplayControl(lblFacetBy) + + ucrInputStation.SetItems({strFacetWrap, strFacetRow, strFacetCol, strNone}) + ucrInputStation.SetDropDownStyleAsNonEditable() + + ucrNudSize.SetLinkedDisplayControl(lblSize) ucrNudWidth.SetLinkedDisplayControl(lblWidth) ucrNudHeigth.SetLinkedDisplayControl(lblHeith) @@ -245,6 +288,15 @@ Public Class dlgScatterPlot clsGeomJitterFunction = New RFunction clsCountGeomFunction = New RFunction clsDummyFunction = New RFunction + clsFacetFunction = New RFunction + clsFacetVariablesOperator = New ROperator + clsFacetRowOp = New ROperator + clsFacetColOp = New ROperator + clsPipeOperator = New ROperator + clsGroupByFunction = New RFunction + + ucrInputStation.SetName(strFacetWrap) + ucrInputStation.bUpdateRCodeFromControl = True ucrSelectorForScatter.Reset() ucrSelectorForScatter.SetGgplotFunction(clsBaseOperator) @@ -293,6 +345,22 @@ Public Class dlgScatterPlot clsGeomJitterFunction.AddParameter("width", 0.4, iPosition:=0) clsGeomJitterFunction.AddParameter("height", 0.4, iPosition:=1) + clsFacetFunction.SetPackageName("ggplot2") + clsFacetRowOp.SetOperation("+") + clsFacetRowOp.bBrackets = False + clsFacetColOp.SetOperation("+") + clsFacetColOp.bBrackets = False + clsFacetVariablesOperator.SetOperation("~") + clsFacetVariablesOperator.bForceIncludeOperation = True + clsFacetVariablesOperator.bBrackets = False + clsFacetFunction.AddParameter("facets", clsROperatorParameter:=clsFacetVariablesOperator, iPosition:=0) + + clsPipeOperator.SetOperation("%>%") + SetPipeAssignTo() + + clsGroupByFunction.SetPackageName("dplyr") + clsGroupByFunction.SetRCommand("group_by") + clsBaseOperator.AddParameter(GgplotDefaults.clsDefaultThemeParameter.Clone()) clsXlabsFunction = GgplotDefaults.clsXlabTitleFunction.Clone() clsYlabsFunction = GgplotDefaults.clsYlabTitleFunction.Clone() @@ -343,6 +411,8 @@ Public Class dlgScatterPlot ucrNudPointsize.SetRCode(clsRScatterGeomFunction, bReset) ucrInputLegend.SetRCode(clsCountGeomFunction, bReset) ucrInputPosition.SetRCode(clsCountGeomFunction, bReset) + ucrChkLegend.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True) + ucrInputLegendPosition.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True) If bReset Then ucrPnlGeoms.SetRCode(clsDummyFunction, bReset) End If @@ -381,6 +451,18 @@ Public Class dlgScatterPlot toolStripMenuItemRugOptions.Enabled = ucrChkAddRugPlot.Checked End Sub + Private Sub AddRemoveTheme() + If clsThemeFunction.iParameterCount > 0 Then + clsBaseOperator.AddParameter("theme", clsRFunctionParameter:=clsThemeFunction, iPosition:=15) + Else + clsBaseOperator.RemoveParameterByName("theme") + End If + End Sub + + Private Sub ucrChkLegend_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLegend.ControlValueChanged, ucrInputLegendPosition.ControlValueChanged + AddRemoveTheme() + End Sub + Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click, toolStripMenuItemPlotOptions.Click sdgPlots.SetRCode(clsNewOperator:=ucrBase.clsRsyntax.clsBaseOperator, clsNewGlobalAesFunction:=clsRaesFunction, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction, @@ -498,4 +580,166 @@ Public Class dlgScatterPlot clsCountGeomFunction.AddParameter("position", Chr(34) & ucrInputPosition.GetText & Chr(34), iPosition:=0) End If End Sub + + Private Sub AutoFacetStation() + Dim ucrCurrentReceiver As ucrReceiver = Nothing + + If ucrSelectorForScatter.CurrentReceiver IsNot Nothing Then + ucrCurrentReceiver = ucrSelectorForScatter.CurrentReceiver + End If + ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrSelectorForScatter.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) + If ucrCurrentReceiver IsNot Nothing Then + ucrCurrentReceiver.SetMeAsReceiver() + End If + AddRemoveGroupBy() + End Sub + + Private Sub ucrInput_ControlValueChanged(ucrChangedControl As ucrInputComboBox) Handles ucrInputStation.ControlValueChanged + If Not bUpdateComboOptions Then + Exit Sub + End If + Dim strChangedText As String = ucrChangedControl.GetText() + If strChangedText <> strNone Then + If Not strChangedText = strFacetCol AndAlso Not strChangedText = strFacetRow AndAlso + Not ucrInputStation.Equals(ucrChangedControl) AndAlso ucrInputStation.GetText() = strChangedText Then + bUpdateComboOptions = False + ucrInputStation.SetName(strNone) + bUpdateComboOptions = True + End If + If (strChangedText = strFacetWrap AndAlso ucrInputStation.GetText = strFacetRow) OrElse (strChangedText = strFacetRow AndAlso + ucrInputStation.GetText = strFacetWrap) OrElse (strChangedText = strFacetWrap AndAlso + ucrInputStation.GetText = strFacetCol) OrElse (strChangedText = strFacetCol AndAlso ucrInputStation.GetText = strFacetWrap) Then + ucrInputStation.SetName(strNone) + End If + End If + UpdateParameters() + AddRemoveFacets() + AddRemoveGroupBy() + End Sub + + Private Sub UpdateParameters() + clsFacetVariablesOperator.RemoveParameterByName("var1") + clsFacetColOp.RemoveParameterByName("col" & ucrInputStation.Name) + clsFacetRowOp.RemoveParameterByName("row" & ucrInputStation.Name) + + clsBaseOperator.RemoveParameterByName("facets") + bUpdatingParameters = True + ucr1stFactorReceiver.SetRCode(Nothing) + Select Case ucrInputStation.GetText() + Case strFacetWrap + ucr1stFactorReceiver.ChangeParameterName("var1") + ucr1stFactorReceiver.SetRCode(clsFacetVariablesOperator) + Case strFacetCol + ucr1stFactorReceiver.ChangeParameterName("col" & ucrInputStation.Name) + ucr1stFactorReceiver.SetRCode(clsFacetColOp) + Case strFacetRow + ucr1stFactorReceiver.ChangeParameterName("row" & ucrInputStation.Name) + ucr1stFactorReceiver.SetRCode(clsFacetRowOp) + End Select + If Not clsRaesFunction.ContainsParameter("x") Then + clsRaesFunction.AddParameter("x", Chr(34) & Chr(34)) + End If + bUpdatingParameters = False + End Sub + + Private Sub AddRemoveFacets() + Dim bWrap As Boolean = False + Dim bCol As Boolean = False + Dim bRow As Boolean = False + + If bUpdatingParameters Then + Exit Sub + End If + + clsBaseOperator.RemoveParameterByName("facets") + If Not ucr1stFactorReceiver.IsEmpty Then + Select Case ucrInputStation.GetText() + Case strFacetWrap + bWrap = True + Case strFacetCol + bCol = True + Case strFacetRow + bRow = True + End Select + End If + + If bWrap OrElse bRow OrElse bCol Then + clsBaseOperator.AddParameter("facets", clsRFunctionParameter:=clsFacetFunction) + End If + If bWrap Then + clsFacetFunction.SetRCommand("facet_wrap") + End If + If bRow OrElse bCol Then + clsFacetFunction.SetRCommand("facet_grid") + End If + If bRow Then + clsFacetVariablesOperator.AddParameter("left", clsROperatorParameter:=clsFacetRowOp, iPosition:=0) + ElseIf bCol AndAlso bWrap = False Then + clsFacetVariablesOperator.AddParameter("left", ".", iPosition:=0) + Else + clsFacetVariablesOperator.RemoveParameterByName("left") + End If + If bCol Then + clsFacetVariablesOperator.AddParameter("right", clsROperatorParameter:=clsFacetColOp, iPosition:=1) + ElseIf bRow AndAlso bWrap = False Then + clsFacetVariablesOperator.AddParameter("right", ".", iPosition:=1) + Else + clsFacetVariablesOperator.RemoveParameterByName("right") + End If + End Sub + + Private Sub ucr1stFactorReceiver_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucr1stFactorReceiver.ControlValueChanged, ucrReceiverX.ControlValueChanged + AddRemoveFacets() + AddRemoveGroupBy() + End Sub + + Private Sub GetParameterValue(clsOperator As ROperator) + Dim i As Integer = 0 + For Each clsTempParam As RParameter In clsOperator.clsParameters + If clsTempParam.strArgumentValue <> "" AndAlso clsTempParam.strArgumentValue <> "." Then + clsGroupByFunction.AddParameter(i, clsTempParam.strArgumentValue, bIncludeArgumentName:=False, iPosition:=i) + i = i + 1 + End If + Next + End Sub + + Private Sub AddRemoveGroupBy() + If clsPipeOperator.ContainsParameter("mutate") Then + clsGroupByFunction.ClearParameters() + If clsBaseOperator.ContainsParameter("facets") Then + Select Case ucrInputStation.GetText() + Case strFacetWrap + GetParameterValue(clsFacetVariablesOperator) + Case strFacetCol + GetParameterValue(clsFacetColOp) + Case strFacetRow + GetParameterValue(clsFacetRowOp) + End Select + End If + + If clsGroupByFunction.iParameterCount > 0 Then + clsPipeOperator.AddParameter("group_by", clsRFunctionParameter:=clsGroupByFunction, iPosition:=1) + Else + clsPipeOperator.RemoveParameterByName("group_by") + End If + Else + clsPipeOperator.RemoveParameterByName("group_by") + End If + + SetPipeAssignTo() + End Sub + + Private Sub SetPipeAssignTo() + If ucrSelectorForScatter.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" AndAlso clsPipeOperator.clsParameters.Count > 1 Then + clsPipeOperator.SetAssignTo(ucrSelectorForScatter.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + Else + clsPipeOperator.RemoveAssignTo() + End If + End Sub + + Private Sub ucrSelectorForScatter_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorForScatter.ControlValueChanged + AutoFacetStation() + SetPipeAssignTo() + End Sub + End Class From adf7e24d0219f8656bf24c223631772d8f4e1a32 Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Tue, 30 Jan 2024 11:06:05 +0300 Subject: [PATCH 2/3] changes to the code --- instat/dlgBarAndPieChart.vb | 13 +++++-------- instat/dlgHistogram.vb | 13 +++++-------- instat/dlgLinePlot.vb | 14 +++++--------- instat/dlgScatterPlot.vb | 13 +++++-------- 4 files changed, 20 insertions(+), 33 deletions(-) diff --git a/instat/dlgBarAndPieChart.vb b/instat/dlgBarAndPieChart.vb index d1ff1e49111..cc5d0acfec9 100644 --- a/instat/dlgBarAndPieChart.vb +++ b/instat/dlgBarAndPieChart.vb @@ -1110,16 +1110,13 @@ Public Class dlgBarAndPieChart End Sub Private Sub AutoFacetStation() - Dim ucrCurrentReceiver As ucrReceiver = Nothing + Dim currentReceiver As ucrReceiver = ucrBarChartSelector.CurrentReceiver - If ucrBarChartSelector.CurrentReceiver IsNot Nothing Then - ucrCurrentReceiver = ucrBarChartSelector.CurrentReceiver + If currentReceiver IsNot Nothing Then + ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) + currentReceiver.SetMeAsReceiver() + AddRemoveGroupBy() End If - ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) - If ucrCurrentReceiver IsNot Nothing Then - ucrCurrentReceiver.SetMeAsReceiver() - End If - AddRemoveGroupBy() End Sub Private Sub ucrInput_ControlValueChanged(ucrChangedControl As ucrInputComboBox) Handles ucrInputStation.ControlValueChanged diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index 3fc31cd62f5..f18b733bea8 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -568,16 +568,13 @@ Public Class dlgHistogram End Sub Private Sub AutoFacetStation() - Dim ucrCurrentReceiver As ucrReceiver = Nothing + Dim currentReceiver As ucrReceiver = ucrHistogramSelector.CurrentReceiver - If ucrHistogramSelector.CurrentReceiver IsNot Nothing Then - ucrCurrentReceiver = ucrHistogramSelector.CurrentReceiver + If currentReceiver IsNot Nothing Then + ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrHistogramSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) + currentReceiver.SetMeAsReceiver() + AddRemoveGroupBy() End If - ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrHistogramSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) - If ucrCurrentReceiver IsNot Nothing Then - ucrCurrentReceiver.SetMeAsReceiver() - End If - AddRemoveGroupBy() End Sub Private Sub ucrInput_ControlValueChanged(ucrChangedControl As ucrInputComboBox) Handles ucrInputStation.ControlValueChanged diff --git a/instat/dlgLinePlot.vb b/instat/dlgLinePlot.vb index a23719978a3..47ab39ee10f 100644 --- a/instat/dlgLinePlot.vb +++ b/instat/dlgLinePlot.vb @@ -959,18 +959,14 @@ Public Class dlgLinePlot End Sub Private Sub AutoFacetStation() - Dim ucrCurrentReceiver As ucrReceiver = Nothing + Dim currentReceiver As ucrReceiver = ucrLinePlotSelector.CurrentReceiver - If ucrLinePlotSelector.CurrentReceiver IsNot Nothing Then - ucrCurrentReceiver = ucrLinePlotSelector.CurrentReceiver + If currentReceiver IsNot Nothing Then + ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrLinePlotSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) + currentReceiver.SetMeAsReceiver() + AddRemoveGroupBy() End If - ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrLinePlotSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) - If ucrCurrentReceiver IsNot Nothing Then - ucrCurrentReceiver.SetMeAsReceiver() - End If - AddRemoveGroupBy() End Sub - Private Sub ucrInput_ControlValueChanged(ucrChangedControl As ucrInputComboBox) Handles ucrInputStation.ControlValueChanged If Not bUpdateComboOptions Then Exit Sub diff --git a/instat/dlgScatterPlot.vb b/instat/dlgScatterPlot.vb index fc4e930fce1..2f69199c046 100644 --- a/instat/dlgScatterPlot.vb +++ b/instat/dlgScatterPlot.vb @@ -582,16 +582,13 @@ Public Class dlgScatterPlot End Sub Private Sub AutoFacetStation() - Dim ucrCurrentReceiver As ucrReceiver = Nothing + Dim currentReceiver As ucrReceiver = ucrSelectorForScatter.CurrentReceiver - If ucrSelectorForScatter.CurrentReceiver IsNot Nothing Then - ucrCurrentReceiver = ucrSelectorForScatter.CurrentReceiver + If currentReceiver IsNot Nothing Then + ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrSelectorForScatter.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) + currentReceiver.SetMeAsReceiver() + AddRemoveGroupBy() End If - ucr1stFactorReceiver.AddItemsWithMetadataProperty(ucrSelectorForScatter.ucrAvailableDataFrames.cboAvailableDataFrames.Text, "Climatic_Type", {"station_label"}) - If ucrCurrentReceiver IsNot Nothing Then - ucrCurrentReceiver.SetMeAsReceiver() - End If - AddRemoveGroupBy() End Sub Private Sub ucrInput_ControlValueChanged(ucrChangedControl As ucrInputComboBox) Handles ucrInputStation.ControlValueChanged From 23cf90fb25b5b019f3e69838d4df48e1a0208db4 Mon Sep 17 00:00:00 2001 From: Barbra2020 Date: Fri, 2 Feb 2024 15:08:18 +0300 Subject: [PATCH 3/3] Changes to the code --- instat/dlgBarAndPieChart.vb | 2 +- instat/dlgHistogram.vb | 2 +- instat/dlgLinePlot.vb | 2 +- instat/dlgScatterPlot.vb | 2 +- instat/sdgPlots.vb | 3 ++- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/instat/dlgBarAndPieChart.vb b/instat/dlgBarAndPieChart.vb index cc5d0acfec9..8b68ddcf059 100644 --- a/instat/dlgBarAndPieChart.vb +++ b/instat/dlgBarAndPieChart.vb @@ -807,7 +807,7 @@ Public Class dlgBarAndPieChart clsNewXLabsTitleFunction:=clsXlabFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewFacetFunction:=clsRFacetFunction, clsNewThemeFunction:=clsThemeFuction, dctNewThemeFunctions:=dctThemeFunctions, clsNewGlobalAesFunction:=clsTempGlobalAesFunction, ucrNewBaseSelector:=ucrBarChartSelector, clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewAnnotateFunction:=clsAnnotateFunction, - clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction, + clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction, clsNewFacetVariablesOperator:=clsFacetVariablesOperator, strMainDialogGeomParameterNames:=strGeomParameterNames, bReset:=bResetSubdialog) sdgPlots.ShowDialog() bResetSubdialog = False diff --git a/instat/dlgHistogram.vb b/instat/dlgHistogram.vb index f18b733bea8..75e3de42232 100644 --- a/instat/dlgHistogram.vb +++ b/instat/dlgHistogram.vb @@ -478,7 +478,7 @@ Public Class dlgHistogram Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click, toolStripMenuItemPlotOptions.Click sdgPlots.SetRCode(clsBaseOperator, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction, clsNewXLabsTitleFunction:=clsXlabsFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewThemeFunction:=clsThemeFunction, clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, - clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, dctNewThemeFunctions:=dctThemeFunctions, clsNewFacetFunction:=clsRFacetFunction, ucrNewBaseSelector:=ucrHistogramSelector, + clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, dctNewThemeFunctions:=dctThemeFunctions, clsNewFacetFunction:=clsRFacetFunction, ucrNewBaseSelector:=ucrHistogramSelector, clsNewFacetVariablesOperator:=clsFacetVariablesOperator, clsNewGlobalAesFunction:=clsRaesFunction, clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewAnnotateFunction:=clsAnnotateFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction, strMainDialogGeomParameterNames:=strGeomParameterNames, bReset:=bResetSubdialog) sdgPlots.ShowDialog() diff --git a/instat/dlgLinePlot.vb b/instat/dlgLinePlot.vb index 47ab39ee10f..7f92eac8db7 100644 --- a/instat/dlgLinePlot.vb +++ b/instat/dlgLinePlot.vb @@ -902,7 +902,7 @@ Public Class dlgLinePlot Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click, PlotOptionsToolStripMenuItem.Click sdgPlots.SetRCode(clsNewOperator:=ucrBase.clsRsyntax.clsBaseOperator, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction, clsNewXLabsTitleFunction:=clsXlabsFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewFacetFunction:=clsRFacetFunction, - clsNewThemeFunction:=clsThemeFunction, dctNewThemeFunctions:=dctThemeFunctions, clsNewGlobalAesFunction:=clsRaesFunction, ucrNewBaseSelector:=ucrLinePlotSelector, + clsNewThemeFunction:=clsThemeFunction, dctNewThemeFunctions:=dctThemeFunctions, clsNewGlobalAesFunction:=clsRaesFunction, ucrNewBaseSelector:=ucrLinePlotSelector, clsNewFacetVariablesOperator:=clsFacetVariablesOperator, clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewAnnotateFunction:=clsAnnotateFunction, clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction, strMainDialogGeomParameterNames:=strGeomParameterNames, bReset:=bResetSubdialog) diff --git a/instat/dlgScatterPlot.vb b/instat/dlgScatterPlot.vb index 2f69199c046..656dfed42bf 100644 --- a/instat/dlgScatterPlot.vb +++ b/instat/dlgScatterPlot.vb @@ -468,7 +468,7 @@ Public Class dlgScatterPlot clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction, clsNewLabsFunction:=clsLabsFunction, clsNewXLabsTitleFunction:=clsXlabsFunction, clsNewYLabTitleFunction:=clsYlabsFunction, clsNewFacetFunction:=clsFacetsFunction, clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, - clsNewThemeFunction:=clsThemeFunction, clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, + clsNewThemeFunction:=clsThemeFunction, clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewFacetVariablesOperator:=clsFacetVariablesOperator, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction, dctNewThemeFunctions:=dctThemeFunctions, ucrNewBaseSelector:=ucrSelectorForScatter, strMainDialogGeomParameterNames:=strGeomParameterNames, clsNewAnnotateFunction:=clsAnnotateFunction, bReset:=bResetSubdialog) diff --git a/instat/sdgPlots.vb b/instat/sdgPlots.vb index de83d3ad2c9..840c21da035 100644 --- a/instat/sdgPlots.vb +++ b/instat/sdgPlots.vb @@ -2383,6 +2383,7 @@ Public Class sdgPlots urChkSelectTheme.SetRCode(clsBaseOperator, bReset, bCloneIfNeeded:=True) ucrPnlHorizonatalVertical.SetRCode(clsFacetFunction, bReset, bCloneIfNeeded:=True) + ucr1stFactorReceiver.SetRCode(clsFacetVariablesOperator, bReset, bCloneIfNeeded:=True) ucr2ndFactorReceiver.SetRCode(clsFacetVariablesOperator, bReset, bCloneIfNeeded:=True) @@ -2391,11 +2392,11 @@ Public Class sdgPlots ucrChkFreeScalesX.SetRCode(clsFacetFunction, bReset, bCloneIfNeeded:=True) If bReset Then ucrChkFreeScalesY.SetRCode(clsFacetFunction, bReset, bCloneIfNeeded:=True) + ucrChkIncludeFacets.SetRCode(clsBaseOperator, bReset, bCloneIfNeeded:=True) End If ucrNudNumberofRows.SetRCode(clsFacetFunction, bReset, bCloneIfNeeded:=True) ucrChkLabeler.SetRCode(clsFacetFunction, bReset, bCloneIfNeeded:=True) ucrChkDrop.SetRCode(clsFacetFunction, bReset, bCloneIfNeeded:=True) - ucrChkIncludeFacets.SetRCode(clsBaseOperator, bReset, bCloneIfNeeded:=True) 'Annnotation ucrChkAnnotation.SetRCode(clsBaseOperator, bReset, bCloneIfNeeded:=True)