From 65b871278ed46618be21f9fb56c658be4cb8bc2e Mon Sep 17 00:00:00 2001 From: Sophie Date: Mon, 5 Dec 2022 08:59:25 +0100 Subject: [PATCH 1/6] Added Pair Plot Options subdialog. --- instat/dlgDescribeTwoVarGraph.Designer.vb | 16 ++- instat/dlgDescribeTwoVarGraph.vb | 24 ++++- instat/instat.vbproj | 9 ++ instat/sdgPairPlotOptions.Designer.vb | 120 ++++++++++++++++++++++ instat/sdgPairPlotOptions.resx | 120 ++++++++++++++++++++++ instat/sdgPairPlotOptions.vb | 87 ++++++++++++++++ 6 files changed, 374 insertions(+), 2 deletions(-) create mode 100644 instat/sdgPairPlotOptions.Designer.vb create mode 100644 instat/sdgPairPlotOptions.resx create mode 100644 instat/sdgPairPlotOptions.vb diff --git a/instat/dlgDescribeTwoVarGraph.Designer.vb b/instat/dlgDescribeTwoVarGraph.Designer.vb index cac687f3ed6..c56613a1fb7 100644 --- a/instat/dlgDescribeTwoVarGraph.Designer.vb +++ b/instat/dlgDescribeTwoVarGraph.Designer.vb @@ -103,6 +103,7 @@ Partial Class dlgDescribeTwoVarGraph Me.ucrChkAddLabelsText = New instat.ucrCheck() Me.lblLabelPosition = New System.Windows.Forms.Label() Me.ucrInputLabelColour = New instat.ucrInputComboBox() + Me.cmdPairOptions = New System.Windows.Forms.Button() Me.grpSummaries.SuspendLayout() Me.grpOptions.SuspendLayout() Me.grpTypeOfDispaly.SuspendLayout() @@ -747,7 +748,7 @@ Partial Class dlgDescribeTwoVarGraph Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrBase.Location = New System.Drawing.Point(10, 460) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 8 ' 'ucrReceiverFirstVars @@ -835,12 +836,24 @@ Partial Class dlgDescribeTwoVarGraph Me.ucrInputLabelColour.Size = New System.Drawing.Size(57, 21) Me.ucrInputLabelColour.TabIndex = 63 ' + 'cmdPairOptions + ' + Me.cmdPairOptions.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdPairOptions.Location = New System.Drawing.Point(12, 226) + Me.cmdPairOptions.Name = "cmdPairOptions" + Me.cmdPairOptions.Size = New System.Drawing.Size(119, 23) + Me.cmdPairOptions.TabIndex = 66 + Me.cmdPairOptions.Tag = "Options..." + Me.cmdPairOptions.Text = "Pair Plot Options" + Me.cmdPairOptions.UseVisualStyleBackColor = True + ' 'dlgDescribeTwoVarGraph ' 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(438, 516) + Me.Controls.Add(Me.cmdPairOptions) Me.Controls.Add(Me.ucrInputLabelSize) Me.Controls.Add(Me.lblLabelColour) Me.Controls.Add(Me.lblLabelSize) @@ -946,4 +959,5 @@ Partial Class dlgDescribeTwoVarGraph Friend WithEvents ucrChkAddLabelsText As ucrCheck Friend WithEvents lblLabelPosition As Label Friend WithEvents ucrInputLabelColour As ucrInputComboBox + Friend WithEvents cmdPairOptions As Button End Class \ No newline at end of file diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index 10b5185322d..8d050e3b198 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -52,6 +52,10 @@ Public Class dlgDescribeTwoVarGraph Private strGeomParameterNames() As String = {"geom_jitter", "geom_violin", "geom_bar", "geom_mosaic", "geom_boxplot", "geom_point", "geom_line", "stat_summary_hline", "stat_summary_crossline", "geom_freqpoly", "geom_histogram", "geom_density"} Private strFirstVariablesType, strSecondVariableType As String + + Private clsOperator As New ROperator + Private clsPairThemesFunction As New RFunction + Private dctThemeFunctions As Dictionary(Of String, RFunction) Private bFirstLoad As Boolean = True Private bReset As Boolean = True @@ -277,6 +281,8 @@ Public Class dlgDescribeTwoVarGraph clsMosaicGgplotFunction = New RFunction clsDummyFunction = New RFunction clsRFacet = New RFunction + clsOperator = New ROperator + clsPairThemesFunction = New RFunction clsThemeFunction = GgplotDefaults.clsDefaultThemeFunction.Clone() dctThemeFunctions = New Dictionary(Of String, RFunction)(GgplotDefaults.dctThemeFunctions) clsGlobalAes = New RFunction @@ -293,6 +299,7 @@ Public Class dlgDescribeTwoVarGraph clsScaleColourViridisFunction = GgplotDefaults.clsScaleColorViridisFunction clsAnnotateFunction = GgplotDefaults.clsAnnotateFunction + clsGeomBoxplot = New RFunction clsGeomJitter = New RFunction clsGeomViolin = New RFunction @@ -329,7 +336,7 @@ Public Class dlgDescribeTwoVarGraph ucrSaveGraph.Reset() ucrSelectorTwoVarGraph.Reset() - cmdOptions.Enabled = False + 'cmdOptions.Enabled = False ucrReceiverFirstVars.SetMeAsReceiver() clsDummyFunction.AddParameter("checked", "pair", iPosition:=0) @@ -463,6 +470,13 @@ Public Class dlgDescribeTwoVarGraph clsGeomHistogram.SetRCommand("geom_histogram") clsGeomHistogram.AddParameter("position", Chr(34) & "dodge" & Chr(34)) + clsPairThemesFunction.SetPackageName("ggplot2") + clsPairThemesFunction.SetRCommand("theme") + clsPairThemesFunction.AddParameter("legend.position", Chr(34) & "none" & Chr(34), iPosition:=0) + + clsOperator.SetOperation("+") + clsOperator.AddParameter("right", clsRFunctionParameter:=clsPairThemesFunction, iPosition:=1) + clsStatSummaryHline.SetPackageName("ggplot2") clsStatSummaryHline.SetRCommand("stat_summary") clsStatSummaryHline.AddParameter("geom", Chr(34) & "hline" & Chr(34), iPosition:=2) @@ -849,6 +863,12 @@ Public Class dlgDescribeTwoVarGraph bResetSubdialog = False End Sub + Private Sub cmdPairOptions_Click(sender As Object, e As EventArgs) Handles cmdPairOptions.Click + sdgPairPlotOptions.SetRCode(clsNewOperetor:=clsOperator, clsNewPairThemesFunction:=clsPairThemesFunction, clsNewGGpairAesFunction:=clsGGpairAesFunction, bReset = bResetSubdialog) + + bResetSubdialog = False + sdgPairPlotOptions.ShowDialog() + End Sub Private Sub SetFreeYAxis() Dim clsScaleParam As RParameter Dim strXName As String @@ -953,9 +973,11 @@ Public Class dlgDescribeTwoVarGraph ucrReceiverFirstVars.SetMeAsReceiver() If rdoBy.Checked Then cmdOptions.Enabled = True + cmdPairOptions.Enabled = False ucrReceiverFirstVars.ucrMultipleVariables.SetSingleTypeStatus(True, bIsCategoricalNumeric:=True) Else cmdOptions.Enabled = False + cmdPairOptions.Enabled = True ucrReceiverFirstVars.ucrMultipleVariables.SetSingleTypeStatus(False) End If If bRCodeSet Then diff --git a/instat/instat.vbproj b/instat/instat.vbproj index 14261159918..bbd8bccd841 100644 --- a/instat/instat.vbproj +++ b/instat/instat.vbproj @@ -239,6 +239,12 @@ + + sdgPairPlotOptions.vb + + + Form + sdgSummaryThemes.vb @@ -3087,6 +3093,9 @@ dlgThreeVariablePivotTable.vb + + sdgPairPlotOptions.vb + sdgSummaryThemes.vb diff --git a/instat/sdgPairPlotOptions.Designer.vb b/instat/sdgPairPlotOptions.Designer.vb new file mode 100644 index 00000000000..b1d2ae2ffbc --- /dev/null +++ b/instat/sdgPairPlotOptions.Designer.vb @@ -0,0 +1,120 @@ + _ +Partial Class sdgPairPlotOptions + Inherits System.Windows.Forms.Form + + 'Form remplace la méthode Dispose pour nettoyer la liste des composants. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Requise par le Concepteur Windows Form + Private components As System.ComponentModel.IContainer + + 'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form + 'Elle peut être modifiée à l'aide du Concepteur Windows Form. + 'Ne la modifiez pas à l'aide de l'éditeur de code. + _ + Private Sub InitializeComponent() + Me.tpLegend = New System.Windows.Forms.TabPage() + Me.ucrChkShowLegend = New instat.ucrCheck() + Me.ucrInputLegendPosition = New instat.ucrInputComboBox() + Me.ucrChkLegendPosition = New instat.ucrCheck() + Me.tbInventory = New System.Windows.Forms.TabControl() + Me.ucrButtonsInventoryplot = New instat.ucrButtonsSubdialogue() + Me.tpLegend.SuspendLayout() + Me.tbInventory.SuspendLayout() + Me.SuspendLayout() + ' + 'tpLegend + ' + Me.tpLegend.Controls.Add(Me.ucrChkShowLegend) + Me.tpLegend.Controls.Add(Me.ucrInputLegendPosition) + Me.tpLegend.Controls.Add(Me.ucrChkLegendPosition) + Me.tpLegend.Location = New System.Drawing.Point(4, 22) + Me.tpLegend.Name = "tpLegend" + Me.tpLegend.Padding = New System.Windows.Forms.Padding(3) + Me.tpLegend.Size = New System.Drawing.Size(320, 171) + Me.tpLegend.TabIndex = 3 + Me.tpLegend.Text = "Legend" + Me.tpLegend.UseVisualStyleBackColor = True + ' + 'ucrChkShowLegend + ' + Me.ucrChkShowLegend.AutoSize = True + Me.ucrChkShowLegend.Checked = False + Me.ucrChkShowLegend.Location = New System.Drawing.Point(12, 18) + Me.ucrChkShowLegend.Name = "ucrChkShowLegend" + Me.ucrChkShowLegend.Size = New System.Drawing.Size(204, 23) + Me.ucrChkShowLegend.TabIndex = 2 + ' + '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(156, 56) + Me.ucrInputLegendPosition.Name = "ucrInputLegendPosition" + Me.ucrInputLegendPosition.Size = New System.Drawing.Size(137, 21) + Me.ucrInputLegendPosition.TabIndex = 1 + ' + 'ucrChkLegendPosition + ' + Me.ucrChkLegendPosition.AutoSize = True + Me.ucrChkLegendPosition.Checked = False + Me.ucrChkLegendPosition.Location = New System.Drawing.Point(12, 58) + Me.ucrChkLegendPosition.Name = "ucrChkLegendPosition" + Me.ucrChkLegendPosition.Size = New System.Drawing.Size(204, 23) + Me.ucrChkLegendPosition.TabIndex = 0 + ' + 'tbInventory + ' + Me.tbInventory.Controls.Add(Me.tpLegend) + Me.tbInventory.Location = New System.Drawing.Point(3, 0) + Me.tbInventory.Name = "tbInventory" + Me.tbInventory.SelectedIndex = 0 + Me.tbInventory.Size = New System.Drawing.Size(328, 197) + Me.tbInventory.TabIndex = 2 + ' + 'ucrButtonsInventoryplot + ' + Me.ucrButtonsInventoryplot.AutoSize = True + Me.ucrButtonsInventoryplot.Location = New System.Drawing.Point(49, 199) + Me.ucrButtonsInventoryplot.Name = "ucrButtonsInventoryplot" + Me.ucrButtonsInventoryplot.Size = New System.Drawing.Size(224, 30) + Me.ucrButtonsInventoryplot.TabIndex = 4 + ' + 'sdgPairPlotOptions + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(347, 237) + Me.Controls.Add(Me.ucrButtonsInventoryplot) + Me.Controls.Add(Me.tbInventory) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "sdgPairPlotOptions" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Pair Plot Options" + Me.tpLegend.ResumeLayout(False) + Me.tpLegend.PerformLayout() + Me.tbInventory.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents tpLegend As TabPage + Friend WithEvents ucrInputLegendPosition As ucrInputComboBox + Friend WithEvents ucrChkLegendPosition As ucrCheck + Friend WithEvents tbInventory As TabControl + Friend WithEvents ucrChkShowLegend As ucrCheck + Friend WithEvents ucrButtonsInventoryplot As ucrButtonsSubdialogue +End Class diff --git a/instat/sdgPairPlotOptions.resx b/instat/sdgPairPlotOptions.resx new file mode 100644 index 00000000000..1af7de150c9 --- /dev/null +++ b/instat/sdgPairPlotOptions.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/instat/sdgPairPlotOptions.vb b/instat/sdgPairPlotOptions.vb new file mode 100644 index 00000000000..47daa8ff5c8 --- /dev/null +++ b/instat/sdgPairPlotOptions.vb @@ -0,0 +1,87 @@ +' R- Instat +' Copyright (C) 2015-2017 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with this program. If not, see . + +Imports instat +Imports instat.Translations +Public Class sdgPairPlotOptions + Public clsOperator As New ROperator + Public clsPairThemesFunction, clsGGpairAesFunction As New RFunction + Private bControlsInitialised As Boolean = False + Private Sub sdgPairPlotOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load + autoTranslate(Me) + End Sub + Public Sub InitialiseControls() + Dim dctLegendPosition As New Dictionary(Of String, String) + + ucrChkShowLegend.SetText("Show Legend") + ucrChkShowLegend.AddParameterPresentCondition(True, "show_legend") + ucrChkShowLegend.AddParameterPresentCondition(False, "show_legend", False) + + ucrChkLegendPosition.SetText("Legend Position") + ucrChkLegendPosition.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) + ucrChkLegendPosition.AddParameterPresentCondition(True, "legend_position") + ucrChkLegendPosition.AddParameterPresentCondition(False, "legend_position", False) + + End Sub + + Public Sub SetRCode(clsNewOperetor As ROperator, clsNewPairThemesFunction As RFunction, clsNewGGpairAesFunction As RFunction, Optional bReset As Boolean = False) + If Not bControlsInitialised Then + InitialiseControls() + End If + + clsOperator = clsNewOperetor + clsPairThemesFunction = clsNewPairThemesFunction + clsGGpairAesFunction = clsNewGGpairAesFunction + + + ucrChkLegendPosition.SetRCode(clsPairThemesFunction, bReset, bCloneIfNeeded:=True) + ucrInputLegendPosition.SetRCode(clsPairThemesFunction, bReset, bCloneIfNeeded:=True) + ucrChkShowLegend.SetRCode(clsGGpairAesFunction, bReset, bCloneIfNeeded:=True) + + 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 ucrChkLegendPosition_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLegendPosition.ControlValueChanged, ucrInputLegendPosition.ControlValueChanged + If ucrChkLegendPosition.Checked Then + clsOperator.AddParameter("right", clsRFunctionParameter:=clsPairThemesFunction, iPosition:=1) + + Else + clsOperator.RemoveParameterByName("right") + End If + + End Sub + + Private Sub ucrChkShowLegend_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkShowLegend.ControlValueChanged + If ucrChkShowLegend.Checked Then + clsGGpairAesFunction.AddParameter("legend", 1, iPosition:=2) + Else + clsGGpairAesFunction.RemoveParameterByName("legend") + End If + End Sub +End Class \ No newline at end of file From 5f3f6390edca62ac8bd3bb34cdf9b48c5536b0e3 Mon Sep 17 00:00:00 2001 From: Sophie Date: Mon, 5 Dec 2022 16:07:57 +0100 Subject: [PATCH 2/6] Added Pair Plot Options. --- instat/dlgDescribeTwoVarGraph.Designer.vb | 2 +- instat/dlgDescribeTwoVarGraph.vb | 53 +++++++++++------------ instat/sdgPairPlotOptions.Designer.vb | 50 ++++++++++----------- instat/sdgPairPlotOptions.vb | 45 ++++++++----------- 4 files changed, 70 insertions(+), 80 deletions(-) diff --git a/instat/dlgDescribeTwoVarGraph.Designer.vb b/instat/dlgDescribeTwoVarGraph.Designer.vb index c56613a1fb7..f8bd1fbf831 100644 --- a/instat/dlgDescribeTwoVarGraph.Designer.vb +++ b/instat/dlgDescribeTwoVarGraph.Designer.vb @@ -839,7 +839,7 @@ Partial Class dlgDescribeTwoVarGraph 'cmdPairOptions ' Me.cmdPairOptions.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdPairOptions.Location = New System.Drawing.Point(12, 226) + Me.cmdPairOptions.Location = New System.Drawing.Point(11, 226) Me.cmdPairOptions.Name = "cmdPairOptions" Me.cmdPairOptions.Size = New System.Drawing.Size(119, 23) Me.cmdPairOptions.TabIndex = 66 diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index 8d050e3b198..912b64e5338 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -17,12 +17,12 @@ Imports instat.Translations Public Class dlgDescribeTwoVarGraph - Private clsBaseOperator, clsCoordPolarStartOperator As New ROperator + Private clsBaseOperator, clsPairOperator, clsCoordPolarStartOperator As New ROperator Private clsRGGplotFunction, clsMosaicGgplotFunction, clsRFacet, clsThemeFunction, clsGlobalAes, clsLabsFunction, clsXlabsFunction, clsYlabFunction, clsXScaleContinuousFunction, clsYScaleContinuousFunction, clsCoordPolarFunction, clsXScaleDateFunction, clsYScaleDateFunction, clsScaleFillViridisFunction, - clsScaleColourViridisFunction As New RFunction + clsScaleColourViridisFunction, clsPairThemesFunction As New RFunction 'Geoms Private clsGeomJitter, clsGeomViolin, clsGeomBar, clsGeomMosaic, clsGeomBoxplot, clsGeomPoint, clsGeomLine, clsStatSummaryHline, clsStatSummaryCrossbar, @@ -53,8 +53,6 @@ Public Class dlgDescribeTwoVarGraph Private strFirstVariablesType, strSecondVariableType As String - Private clsOperator As New ROperator - Private clsPairThemesFunction As New RFunction Private dctThemeFunctions As Dictionary(Of String, RFunction) Private bFirstLoad As Boolean = True @@ -278,11 +276,11 @@ Public Class dlgDescribeTwoVarGraph Private Sub SetDefaults() clsGGpairsFunction = New RFunction clsRGGplotFunction = New RFunction + clsPairThemesFunction = New RFunction clsMosaicGgplotFunction = New RFunction clsDummyFunction = New RFunction + clsPairOperator = New ROperator clsRFacet = New RFunction - clsOperator = New ROperator - clsPairThemesFunction = New RFunction clsThemeFunction = GgplotDefaults.clsDefaultThemeFunction.Clone() dctThemeFunctions = New Dictionary(Of String, RFunction)(GgplotDefaults.dctThemeFunctions) clsGlobalAes = New RFunction @@ -299,7 +297,6 @@ Public Class dlgDescribeTwoVarGraph clsScaleColourViridisFunction = GgplotDefaults.clsScaleColorViridisFunction clsAnnotateFunction = GgplotDefaults.clsAnnotateFunction - clsGeomBoxplot = New RFunction clsGeomJitter = New RFunction clsGeomViolin = New RFunction @@ -376,6 +373,13 @@ Public Class dlgDescribeTwoVarGraph clsGGpairsFunction.SetPackageName("GGally") clsGGpairsFunction.SetRCommand("ggpairs") + clsPairThemesFunction.SetPackageName("ggplot2") + clsPairThemesFunction.SetRCommand("theme") + clsPairThemesFunction.AddParameter("legend.position", Chr(34) & "none" & Chr(34), iPosition:=0) + + clsPairOperator.SetOperation("+") + clsPairOperator.AddParameter("left", clsRFunctionParameter:=clsGGpairsFunction, iPosition:=0) + clsBaseOperator.SetOperation("+") clsRGGplotFunction.SetPackageName("ggplot2") @@ -470,13 +474,6 @@ Public Class dlgDescribeTwoVarGraph clsGeomHistogram.SetRCommand("geom_histogram") clsGeomHistogram.AddParameter("position", Chr(34) & "dodge" & Chr(34)) - clsPairThemesFunction.SetPackageName("ggplot2") - clsPairThemesFunction.SetRCommand("theme") - clsPairThemesFunction.AddParameter("legend.position", Chr(34) & "none" & Chr(34), iPosition:=0) - - clsOperator.SetOperation("+") - clsOperator.AddParameter("right", clsRFunctionParameter:=clsPairThemesFunction, iPosition:=1) - clsStatSummaryHline.SetPackageName("ggplot2") clsStatSummaryHline.SetRCommand("stat_summary") clsStatSummaryHline.AddParameter("geom", Chr(34) & "hline" & Chr(34), iPosition:=2) @@ -496,9 +493,11 @@ Public Class dlgDescribeTwoVarGraph clsBaseOperator.AddParameter("ggplot", clsRFunctionParameter:=clsRGGplotFunction, iPosition:=0) clsBaseOperator.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorTwoVarGraph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") - ucrBase.clsRsyntax.SetBaseRFunction(clsGGpairsFunction) + clsPairOperator.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorTwoVarGraph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") + + ucrBase.clsRsyntax.SetBaseROperator(clsPairOperator) + AddDataFrame() - ' bResetSubdialog = True End Sub Private Sub SetRCodeForControls(bReset As Boolean) @@ -509,7 +508,7 @@ Public Class dlgDescribeTwoVarGraph ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsAesCategoricalByNumericXNumeric, New RParameter("x", 0), iAdditionalPairNo:=4) ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsAesNumericByNumeric, New RParameter("x", 0), iAdditionalPairNo:=5) ucrReceiverSecondVar.AddAdditionalCodeParameterPair(clsAesStatSummaryHlineCategoricalByNumeric, New RParameter("y", 1), iAdditionalPairNo:=6) - ucrSaveGraph.AddAdditionalRCode(clsGGpairsFunction, bReset) + ucrSaveGraph.AddAdditionalRCode(clsPairOperator, bReset) ucrSelectorTwoVarGraph.SetRCode(clsRGGplotFunction, bReset) ucrReceiverSecondVar.SetRCode(clsAesCategoricalByCategoricalBarChart, bReset) @@ -546,12 +545,10 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub TestOkEnabled() - If rdoBy.Checked AndAlso Not ucrReceiverFirstVars.IsEmpty AndAlso Not ucrReceiverSecondVar.IsEmpty AndAlso ucrSaveGraph.IsComplete Then - ucrBase.OKEnabled(True) - ElseIf rdoPairs.Checked AndAlso Not ucrReceiverFirstVars.IsEmpty Then - ucrBase.OKEnabled(True) + If rdoBy.Checked Then + ucrBase.OKEnabled(Not ucrReceiverFirstVars.IsEmpty AndAlso Not ucrReceiverSecondVar.IsEmpty AndAlso ucrSaveGraph.IsComplete) Else - ucrBase.OKEnabled(False) + ucrBase.OKEnabled(Not ucrReceiverFirstVars.IsEmpty AndAlso Not ucrReceiverColour.IsEmpty) End If End Sub @@ -824,7 +821,9 @@ Public Class dlgDescribeTwoVarGraph ChangeGeomToMosaicAndFacet() End Sub - Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSecondVar.ControlContentsChanged, ucrReceiverFirstVars.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged, ucrPnlByPairs.ControlContentsChanged + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverSecondVar.ControlContentsChanged, + ucrReceiverFirstVars.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged, + ucrPnlByPairs.ControlContentsChanged, ucrReceiverColour.ControlContentsChanged TestOkEnabled() End Sub @@ -858,16 +857,15 @@ Public Class dlgDescribeTwoVarGraph sdgPlots.tbpFacet.Enabled = False sdgPlots.ShowDialog() sdgPlots.tbpFacet.Enabled = True - ' Readd as may get removed by subdialog clsRFacet.AddParameter("facets", "~variable", iPosition:=0) bResetSubdialog = False End Sub Private Sub cmdPairOptions_Click(sender As Object, e As EventArgs) Handles cmdPairOptions.Click - sdgPairPlotOptions.SetRCode(clsNewOperetor:=clsOperator, clsNewPairThemesFunction:=clsPairThemesFunction, clsNewGGpairAesFunction:=clsGGpairAesFunction, bReset = bResetSubdialog) + sdgPairPlotOptions.SetRCode(clsNewPairOperator:=clsPairOperator, clsNewPairThemesFunction:=clsPairThemesFunction, clsNewGGpairAesFunction:=clsGGpairsFunction, bReset:=bResetSubdialog) - bResetSubdialog = False sdgPairPlotOptions.ShowDialog() + bResetSubdialog = False End Sub Private Sub SetFreeYAxis() Dim clsScaleParam As RParameter @@ -918,7 +916,6 @@ Public Class dlgDescribeTwoVarGraph strXName = "x" strYName = "y" End If - If bAdd Then If clsRFacet.ContainsParameter("scales") Then clsScaleParam = clsRFacet.GetParameter("scales") @@ -985,7 +982,7 @@ Public Class dlgDescribeTwoVarGraph ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator) clsDummyFunction.AddParameter("checked", "by", iPosition:=0) Else - ucrBase.clsRsyntax.SetBaseRFunction(clsGGpairsFunction) + ucrBase.clsRsyntax.SetBaseROperator(clsPairOperator) clsDummyFunction.AddParameter("checked", "pair", iPosition:=0) End If End If diff --git a/instat/sdgPairPlotOptions.Designer.vb b/instat/sdgPairPlotOptions.Designer.vb index b1d2ae2ffbc..31cf26d0867 100644 --- a/instat/sdgPairPlotOptions.Designer.vb +++ b/instat/sdgPairPlotOptions.Designer.vb @@ -23,11 +23,11 @@ Partial Class sdgPairPlotOptions _ Private Sub InitializeComponent() Me.tpLegend = New System.Windows.Forms.TabPage() + Me.tbInventory = New System.Windows.Forms.TabControl() + Me.ucrButtonsInventoryplot = New instat.ucrButtonsSubdialogue() Me.ucrChkShowLegend = New instat.ucrCheck() Me.ucrInputLegendPosition = New instat.ucrInputComboBox() Me.ucrChkLegendPosition = New instat.ucrCheck() - Me.tbInventory = New System.Windows.Forms.TabControl() - Me.ucrButtonsInventoryplot = New instat.ucrButtonsSubdialogue() Me.tpLegend.SuspendLayout() Me.tbInventory.SuspendLayout() Me.SuspendLayout() @@ -40,16 +40,33 @@ Partial Class sdgPairPlotOptions Me.tpLegend.Location = New System.Drawing.Point(4, 22) Me.tpLegend.Name = "tpLegend" Me.tpLegend.Padding = New System.Windows.Forms.Padding(3) - Me.tpLegend.Size = New System.Drawing.Size(320, 171) + Me.tpLegend.Size = New System.Drawing.Size(299, 62) Me.tpLegend.TabIndex = 3 Me.tpLegend.Text = "Legend" Me.tpLegend.UseVisualStyleBackColor = True ' + 'tbInventory + ' + Me.tbInventory.Controls.Add(Me.tpLegend) + Me.tbInventory.Location = New System.Drawing.Point(3, 0) + Me.tbInventory.Name = "tbInventory" + Me.tbInventory.SelectedIndex = 0 + Me.tbInventory.Size = New System.Drawing.Size(307, 88) + Me.tbInventory.TabIndex = 2 + ' + 'ucrButtonsInventoryplot + ' + Me.ucrButtonsInventoryplot.AutoSize = True + Me.ucrButtonsInventoryplot.Location = New System.Drawing.Point(46, 94) + Me.ucrButtonsInventoryplot.Name = "ucrButtonsInventoryplot" + Me.ucrButtonsInventoryplot.Size = New System.Drawing.Size(224, 30) + Me.ucrButtonsInventoryplot.TabIndex = 4 + ' 'ucrChkShowLegend ' Me.ucrChkShowLegend.AutoSize = True Me.ucrChkShowLegend.Checked = False - Me.ucrChkShowLegend.Location = New System.Drawing.Point(12, 18) + Me.ucrChkShowLegend.Location = New System.Drawing.Point(7, 5) Me.ucrChkShowLegend.Name = "ucrChkShowLegend" Me.ucrChkShowLegend.Size = New System.Drawing.Size(204, 23) Me.ucrChkShowLegend.TabIndex = 2 @@ -60,42 +77,25 @@ Partial Class sdgPairPlotOptions Me.ucrInputLegendPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputLegendPosition.GetSetSelectedIndex = -1 Me.ucrInputLegendPosition.IsReadOnly = False - Me.ucrInputLegendPosition.Location = New System.Drawing.Point(156, 56) + Me.ucrInputLegendPosition.Location = New System.Drawing.Point(154, 33) Me.ucrInputLegendPosition.Name = "ucrInputLegendPosition" - Me.ucrInputLegendPosition.Size = New System.Drawing.Size(137, 21) + Me.ucrInputLegendPosition.Size = New System.Drawing.Size(134, 25) Me.ucrInputLegendPosition.TabIndex = 1 ' 'ucrChkLegendPosition ' Me.ucrChkLegendPosition.AutoSize = True Me.ucrChkLegendPosition.Checked = False - Me.ucrChkLegendPosition.Location = New System.Drawing.Point(12, 58) + Me.ucrChkLegendPosition.Location = New System.Drawing.Point(7, 35) Me.ucrChkLegendPosition.Name = "ucrChkLegendPosition" Me.ucrChkLegendPosition.Size = New System.Drawing.Size(204, 23) Me.ucrChkLegendPosition.TabIndex = 0 ' - 'tbInventory - ' - Me.tbInventory.Controls.Add(Me.tpLegend) - Me.tbInventory.Location = New System.Drawing.Point(3, 0) - Me.tbInventory.Name = "tbInventory" - Me.tbInventory.SelectedIndex = 0 - Me.tbInventory.Size = New System.Drawing.Size(328, 197) - Me.tbInventory.TabIndex = 2 - ' - 'ucrButtonsInventoryplot - ' - Me.ucrButtonsInventoryplot.AutoSize = True - Me.ucrButtonsInventoryplot.Location = New System.Drawing.Point(49, 199) - Me.ucrButtonsInventoryplot.Name = "ucrButtonsInventoryplot" - Me.ucrButtonsInventoryplot.Size = New System.Drawing.Size(224, 30) - Me.ucrButtonsInventoryplot.TabIndex = 4 - ' 'sdgPairPlotOptions ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(347, 237) + Me.ClientSize = New System.Drawing.Size(314, 128) Me.Controls.Add(Me.ucrButtonsInventoryplot) Me.Controls.Add(Me.tbInventory) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow diff --git a/instat/sdgPairPlotOptions.vb b/instat/sdgPairPlotOptions.vb index 47daa8ff5c8..f179e8217d1 100644 --- a/instat/sdgPairPlotOptions.vb +++ b/instat/sdgPairPlotOptions.vb @@ -17,9 +17,10 @@ Imports instat Imports instat.Translations Public Class sdgPairPlotOptions - Public clsOperator As New ROperator - Public clsPairThemesFunction, clsGGpairAesFunction As New RFunction + Public clsPairOperator As New ROperator + Public clsPairThemesFunction, clsGGpairsFunction As New RFunction Private bControlsInitialised As Boolean = False + Private Sub sdgPairPlotOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) End Sub @@ -43,45 +44,37 @@ Public Class sdgPairPlotOptions ucrChkLegendPosition.AddParameterPresentCondition(True, "legend_position") ucrChkLegendPosition.AddParameterPresentCondition(False, "legend_position", False) + bControlsInitialised = True End Sub - Public Sub SetRCode(clsNewOperetor As ROperator, clsNewPairThemesFunction As RFunction, clsNewGGpairAesFunction As RFunction, Optional bReset As Boolean = False) + Public Sub SetRCode(clsNewPairOperator As ROperator, clsNewPairThemesFunction As RFunction, clsNewGGpairAesFunction As RFunction, Optional bReset As Boolean = False) + clsPairOperator = clsNewPairOperator + clsPairThemesFunction = clsNewPairThemesFunction + clsGGpairsFunction = clsNewGGpairAesFunction + If Not bControlsInitialised Then InitialiseControls() End If - - clsOperator = clsNewOperetor - clsPairThemesFunction = clsNewPairThemesFunction - clsGGpairAesFunction = clsNewGGpairAesFunction - - - ucrChkLegendPosition.SetRCode(clsPairThemesFunction, bReset, bCloneIfNeeded:=True) - ucrInputLegendPosition.SetRCode(clsPairThemesFunction, bReset, bCloneIfNeeded:=True) - ucrChkShowLegend.SetRCode(clsGGpairAesFunction, bReset, bCloneIfNeeded:=True) - + If bReset Then + ucrChkShowLegend.SetRCode(clsGGpairsFunction, bReset, bCloneIfNeeded:=True) + ucrChkLegendPosition.SetRCode(clsPairThemesFunction, bReset, bCloneIfNeeded:=True) + ucrInputLegendPosition.SetRCode(clsPairThemesFunction, bReset, bCloneIfNeeded:=True) + 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 ucrChkLegendPosition_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLegendPosition.ControlValueChanged, ucrInputLegendPosition.ControlValueChanged If ucrChkLegendPosition.Checked Then - clsOperator.AddParameter("right", clsRFunctionParameter:=clsPairThemesFunction, iPosition:=1) - + clsPairOperator.AddParameter("right", clsRFunctionParameter:=clsPairThemesFunction, iPosition:=1) Else - clsOperator.RemoveParameterByName("right") + clsPairOperator.RemoveParameterByName("right") End If - End Sub Private Sub ucrChkShowLegend_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkShowLegend.ControlValueChanged If ucrChkShowLegend.Checked Then - clsGGpairAesFunction.AddParameter("legend", 1, iPosition:=2) + clsGGpairsFunction.AddParameter("legend", 1, iPosition:=2) Else - clsGGpairAesFunction.RemoveParameterByName("legend") + clsGGpairsFunction.RemoveParameterByName("legend") End If End Sub End Class \ No newline at end of file From 0fca499345f45efaaffacaa4ebe0372bdcb546ac Mon Sep 17 00:00:00 2001 From: Sophie Date: Tue, 6 Dec 2022 10:38:17 +0100 Subject: [PATCH 3/6] Minor code modification --- instat/dlgDescribeTwoVarGraph.vb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index 912b64e5338..afc8cb8d94d 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -333,7 +333,6 @@ Public Class dlgDescribeTwoVarGraph ucrSaveGraph.Reset() ucrSelectorTwoVarGraph.Reset() - 'cmdOptions.Enabled = False ucrReceiverFirstVars.SetMeAsReceiver() clsDummyFunction.AddParameter("checked", "pair", iPosition:=0) @@ -969,12 +968,12 @@ Public Class dlgDescribeTwoVarGraph ucrReceiverFirstVars.ucrMultipleVariables.Clear() ucrReceiverFirstVars.SetMeAsReceiver() If rdoBy.Checked Then - cmdOptions.Enabled = True - cmdPairOptions.Enabled = False + cmdOptions.Visible = True + cmdPairOptions.Visible = False ucrReceiverFirstVars.ucrMultipleVariables.SetSingleTypeStatus(True, bIsCategoricalNumeric:=True) Else - cmdOptions.Enabled = False - cmdPairOptions.Enabled = True + cmdOptions.Visible = False + cmdPairOptions.Visible = True ucrReceiverFirstVars.ucrMultipleVariables.SetSingleTypeStatus(False) End If If bRCodeSet Then From 9f7e9d916b44d92357627fb398e364e107abe7f0 Mon Sep 17 00:00:00 2001 From: Sophie Date: Wed, 14 Dec 2022 11:24:19 +0100 Subject: [PATCH 4/6] Minor modification on code and design. --- instat/dlgDescribeTwoVarGraph.vb | 22 +++++++--- instat/sdgPairPlotOptions.Designer.vb | 58 +++++++++++---------------- instat/sdgPairPlotOptions.vb | 18 +++------ 3 files changed, 45 insertions(+), 53 deletions(-) diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index afc8cb8d94d..2dfd294fe18 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -547,7 +547,7 @@ Public Class dlgDescribeTwoVarGraph If rdoBy.Checked Then ucrBase.OKEnabled(Not ucrReceiverFirstVars.IsEmpty AndAlso Not ucrReceiverSecondVar.IsEmpty AndAlso ucrSaveGraph.IsComplete) Else - ucrBase.OKEnabled(Not ucrReceiverFirstVars.IsEmpty AndAlso Not ucrReceiverColour.IsEmpty) + ucrBase.OKEnabled(Not ucrReceiverFirstVars.IsEmpty) End If End Sub @@ -968,12 +968,8 @@ Public Class dlgDescribeTwoVarGraph ucrReceiverFirstVars.ucrMultipleVariables.Clear() ucrReceiverFirstVars.SetMeAsReceiver() If rdoBy.Checked Then - cmdOptions.Visible = True - cmdPairOptions.Visible = False ucrReceiverFirstVars.ucrMultipleVariables.SetSingleTypeStatus(True, bIsCategoricalNumeric:=True) Else - cmdOptions.Visible = False - cmdPairOptions.Visible = True ucrReceiverFirstVars.ucrMultipleVariables.SetSingleTypeStatus(False) End If If bRCodeSet Then @@ -988,6 +984,7 @@ Public Class dlgDescribeTwoVarGraph EnableVisibleLabelControls() AddRemoveColourParameter() ChangeGeomToMosaicAndFacet() + HideShowOptions() End Sub Private Sub ucrSelectorTwoVarGraph_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorTwoVarGraph.ControlValueChanged @@ -1003,8 +1000,23 @@ Public Class dlgDescribeTwoVarGraph Private Sub ucrReceiverColour_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverColour.ControlValueChanged AddRemoveColourParameter() + HideShowOptions() End Sub + Private Sub HideShowOptions() + If rdoPairs.Checked Then + cmdOptions.Visible = False + cmdPairOptions.Visible = True + If Not ucrReceiverColour.IsEmpty Then + cmdPairOptions.Enabled = True + Else + cmdPairOptions.Enabled = False + End If + Else + cmdPairOptions.Visible = False + cmdOptions.Visible = True + End If + End Sub Private Sub AddRemoveColourParameter() If Not ucrReceiverColour.IsEmpty And rdoPairs.Checked Then clsGGpairsFunction.AddParameter("colour", clsRFunctionParameter:=clsGGpairAesFunction, bIncludeArgumentName:=False, iPosition:=2) diff --git a/instat/sdgPairPlotOptions.Designer.vb b/instat/sdgPairPlotOptions.Designer.vb index 31cf26d0867..859df509766 100644 --- a/instat/sdgPairPlotOptions.Designer.vb +++ b/instat/sdgPairPlotOptions.Designer.vb @@ -23,61 +23,33 @@ Partial Class sdgPairPlotOptions _ Private Sub InitializeComponent() Me.tpLegend = New System.Windows.Forms.TabPage() - Me.tbInventory = New System.Windows.Forms.TabControl() - Me.ucrButtonsInventoryplot = New instat.ucrButtonsSubdialogue() - Me.ucrChkShowLegend = New instat.ucrCheck() Me.ucrInputLegendPosition = New instat.ucrInputComboBox() Me.ucrChkLegendPosition = New instat.ucrCheck() + Me.tbInventory = New System.Windows.Forms.TabControl() + Me.ucrButtonsInventoryplot = New instat.ucrButtonsSubdialogue() Me.tpLegend.SuspendLayout() Me.tbInventory.SuspendLayout() Me.SuspendLayout() ' 'tpLegend ' - Me.tpLegend.Controls.Add(Me.ucrChkShowLegend) Me.tpLegend.Controls.Add(Me.ucrInputLegendPosition) Me.tpLegend.Controls.Add(Me.ucrChkLegendPosition) Me.tpLegend.Location = New System.Drawing.Point(4, 22) Me.tpLegend.Name = "tpLegend" Me.tpLegend.Padding = New System.Windows.Forms.Padding(3) - Me.tpLegend.Size = New System.Drawing.Size(299, 62) + Me.tpLegend.Size = New System.Drawing.Size(291, 36) Me.tpLegend.TabIndex = 3 Me.tpLegend.Text = "Legend" Me.tpLegend.UseVisualStyleBackColor = True ' - 'tbInventory - ' - Me.tbInventory.Controls.Add(Me.tpLegend) - Me.tbInventory.Location = New System.Drawing.Point(3, 0) - Me.tbInventory.Name = "tbInventory" - Me.tbInventory.SelectedIndex = 0 - Me.tbInventory.Size = New System.Drawing.Size(307, 88) - Me.tbInventory.TabIndex = 2 - ' - 'ucrButtonsInventoryplot - ' - Me.ucrButtonsInventoryplot.AutoSize = True - Me.ucrButtonsInventoryplot.Location = New System.Drawing.Point(46, 94) - Me.ucrButtonsInventoryplot.Name = "ucrButtonsInventoryplot" - Me.ucrButtonsInventoryplot.Size = New System.Drawing.Size(224, 30) - Me.ucrButtonsInventoryplot.TabIndex = 4 - ' - 'ucrChkShowLegend - ' - Me.ucrChkShowLegend.AutoSize = True - Me.ucrChkShowLegend.Checked = False - Me.ucrChkShowLegend.Location = New System.Drawing.Point(7, 5) - Me.ucrChkShowLegend.Name = "ucrChkShowLegend" - Me.ucrChkShowLegend.Size = New System.Drawing.Size(204, 23) - Me.ucrChkShowLegend.TabIndex = 2 - ' '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(154, 33) + Me.ucrInputLegendPosition.Location = New System.Drawing.Point(154, 3) Me.ucrInputLegendPosition.Name = "ucrInputLegendPosition" Me.ucrInputLegendPosition.Size = New System.Drawing.Size(134, 25) Me.ucrInputLegendPosition.TabIndex = 1 @@ -86,16 +58,33 @@ Partial Class sdgPairPlotOptions ' Me.ucrChkLegendPosition.AutoSize = True Me.ucrChkLegendPosition.Checked = False - Me.ucrChkLegendPosition.Location = New System.Drawing.Point(7, 35) + Me.ucrChkLegendPosition.Location = New System.Drawing.Point(7, 5) Me.ucrChkLegendPosition.Name = "ucrChkLegendPosition" Me.ucrChkLegendPosition.Size = New System.Drawing.Size(204, 23) Me.ucrChkLegendPosition.TabIndex = 0 ' + 'tbInventory + ' + Me.tbInventory.Controls.Add(Me.tpLegend) + Me.tbInventory.Location = New System.Drawing.Point(3, 0) + Me.tbInventory.Name = "tbInventory" + Me.tbInventory.SelectedIndex = 0 + Me.tbInventory.Size = New System.Drawing.Size(299, 62) + Me.tbInventory.TabIndex = 2 + ' + 'ucrButtonsInventoryplot + ' + Me.ucrButtonsInventoryplot.AutoSize = True + Me.ucrButtonsInventoryplot.Location = New System.Drawing.Point(46, 64) + Me.ucrButtonsInventoryplot.Name = "ucrButtonsInventoryplot" + Me.ucrButtonsInventoryplot.Size = New System.Drawing.Size(224, 30) + Me.ucrButtonsInventoryplot.TabIndex = 4 + ' 'sdgPairPlotOptions ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(314, 128) + Me.ClientSize = New System.Drawing.Size(311, 98) Me.Controls.Add(Me.ucrButtonsInventoryplot) Me.Controls.Add(Me.tbInventory) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow @@ -115,6 +104,5 @@ Partial Class sdgPairPlotOptions Friend WithEvents ucrInputLegendPosition As ucrInputComboBox Friend WithEvents ucrChkLegendPosition As ucrCheck Friend WithEvents tbInventory As TabControl - Friend WithEvents ucrChkShowLegend As ucrCheck Friend WithEvents ucrButtonsInventoryplot As ucrButtonsSubdialogue End Class diff --git a/instat/sdgPairPlotOptions.vb b/instat/sdgPairPlotOptions.vb index f179e8217d1..cf9928a2ce7 100644 --- a/instat/sdgPairPlotOptions.vb +++ b/instat/sdgPairPlotOptions.vb @@ -27,10 +27,6 @@ Public Class sdgPairPlotOptions Public Sub InitialiseControls() Dim dctLegendPosition As New Dictionary(Of String, String) - ucrChkShowLegend.SetText("Show Legend") - ucrChkShowLegend.AddParameterPresentCondition(True, "show_legend") - ucrChkShowLegend.AddParameterPresentCondition(False, "show_legend", False) - ucrChkLegendPosition.SetText("Legend Position") ucrChkLegendPosition.AddToLinkedControls(ucrInputLegendPosition, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="None") ucrInputLegendPosition.SetDropDownStyleAsNonEditable() @@ -56,7 +52,6 @@ Public Class sdgPairPlotOptions InitialiseControls() End If If bReset Then - ucrChkShowLegend.SetRCode(clsGGpairsFunction, bReset, bCloneIfNeeded:=True) ucrChkLegendPosition.SetRCode(clsPairThemesFunction, bReset, bCloneIfNeeded:=True) ucrInputLegendPosition.SetRCode(clsPairThemesFunction, bReset, bCloneIfNeeded:=True) End If @@ -65,16 +60,13 @@ Public Class sdgPairPlotOptions Private Sub ucrChkLegendPosition_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkLegendPosition.ControlValueChanged, ucrInputLegendPosition.ControlValueChanged If ucrChkLegendPosition.Checked Then clsPairOperator.AddParameter("right", clsRFunctionParameter:=clsPairThemesFunction, iPosition:=1) + If ucrInputLegendPosition.GetText = "None" Then + clsGGpairsFunction.RemoveParameterByName("legend") + Else + clsGGpairsFunction.AddParameter("legend", 1, iPosition:=2) + End If Else clsPairOperator.RemoveParameterByName("right") End If End Sub - - Private Sub ucrChkShowLegend_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkShowLegend.ControlValueChanged - If ucrChkShowLegend.Checked Then - clsGGpairsFunction.AddParameter("legend", 1, iPosition:=2) - Else - clsGGpairsFunction.RemoveParameterByName("legend") - End If - End Sub End Class \ No newline at end of file From bd41ea185a407716b934b9f3aba35750767eb12a Mon Sep 17 00:00:00 2001 From: Sophie Date: Wed, 14 Dec 2022 11:25:20 +0100 Subject: [PATCH 5/6] Minor modification on code --- instat/dlgDescribeTwoVarGraph.vb | 2 +- instat/sdgPairPlotOptions.vb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index 2dfd294fe18..846f2c4cf5a 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -53,7 +53,6 @@ Public Class dlgDescribeTwoVarGraph Private strFirstVariablesType, strSecondVariableType As String - Private dctThemeFunctions As Dictionary(Of String, RFunction) Private bFirstLoad As Boolean = True Private bReset As Boolean = True @@ -866,6 +865,7 @@ Public Class dlgDescribeTwoVarGraph sdgPairPlotOptions.ShowDialog() bResetSubdialog = False End Sub + Private Sub SetFreeYAxis() Dim clsScaleParam As RParameter Dim strXName As String diff --git a/instat/sdgPairPlotOptions.vb b/instat/sdgPairPlotOptions.vb index cf9928a2ce7..2d2de9bb207 100644 --- a/instat/sdgPairPlotOptions.vb +++ b/instat/sdgPairPlotOptions.vb @@ -24,6 +24,7 @@ Public Class sdgPairPlotOptions Private Sub sdgPairPlotOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) End Sub + Public Sub InitialiseControls() Dim dctLegendPosition As New Dictionary(Of String, String) From 8cf629c94936f4690f353ee2482251b6b74d54ce Mon Sep 17 00:00:00 2001 From: Sophie Date: Wed, 4 Jan 2023 13:59:55 +0100 Subject: [PATCH 6/6] minor modification code --- instat/dlgDescribeTwoVarGraph.vb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index 846f2c4cf5a..4b7340e7178 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -1004,19 +1004,11 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub HideShowOptions() - If rdoPairs.Checked Then - cmdOptions.Visible = False - cmdPairOptions.Visible = True - If Not ucrReceiverColour.IsEmpty Then - cmdPairOptions.Enabled = True - Else - cmdPairOptions.Enabled = False - End If - Else - cmdPairOptions.Visible = False - cmdOptions.Visible = True - End If + cmdOptions.Visible = Not rdoPairs.Checked + cmdPairOptions.Visible = rdoPairs.Checked + cmdPairOptions.Enabled = cmdPairOptions.Visible AndAlso Not ucrReceiverColour.IsEmpty End Sub + Private Sub AddRemoveColourParameter() If Not ucrReceiverColour.IsEmpty And rdoPairs.Checked Then clsGGpairsFunction.AddParameter("colour", clsRFunctionParameter:=clsGGpairAesFunction, bIncludeArgumentName:=False, iPosition:=2)