From ce619b74f396b797c406fa5c552b6c8887d02adc Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Tue, 5 Sep 2023 11:52:58 +0100 Subject: [PATCH 1/4] Added Jitter check box on Scatter Plot Dialog --- instat/dlgScatterPlot.Designer.vb | 96 ++++++++++++++++++++++++++----- instat/dlgScatterPlot.vb | 48 ++++++++++++++++ 2 files changed, 130 insertions(+), 14 deletions(-) diff --git a/instat/dlgScatterPlot.Designer.vb b/instat/dlgScatterPlot.Designer.vb index 381ed0151f5..8f451775273 100644 --- a/instat/dlgScatterPlot.Designer.vb +++ b/instat/dlgScatterPlot.Designer.vb @@ -49,6 +49,7 @@ Partial Class dlgScatterPlot Me.toolStripMenuItemPointOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemRugOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemSmoothOptions = New System.Windows.Forms.ToolStripMenuItem() + Me.toolStripMenuItemTextrepelOptions = New System.Windows.Forms.ToolStripMenuItem() Me.cmdOptions = New instat.ucrSplitButton() Me.ucrInputSides = New instat.ucrInputComboBox() Me.ucrNudSize = New instat.ucrNud() @@ -62,7 +63,11 @@ Partial Class dlgScatterPlot Me.ucrFactorOptionalReceiver = New instat.ucrReceiverSingle() Me.ucrReceiverX = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() - Me.toolStripMenuItemTextrepelOptions = New System.Windows.Forms.ToolStripMenuItem() + Me.lblWidth = New System.Windows.Forms.Label() + Me.ucrNudWidth = New instat.ucrNud() + Me.ucrChkJitter = New instat.ucrCheck() + Me.lblHeith = New System.Windows.Forms.Label() + Me.ucrNudHeigth = New instat.ucrNud() Me.contextMenuStripOptions.SuspendLayout() Me.SuspendLayout() ' @@ -121,32 +126,38 @@ Partial Class dlgScatterPlot ' Me.contextMenuStripOptions.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripMenuItemPlotOptions, Me.toolStripMenuItemPointOptions, Me.toolStripMenuItemRugOptions, Me.toolStripMenuItemSmoothOptions, Me.toolStripMenuItemTextrepelOptions}) Me.contextMenuStripOptions.Name = "contextMenuStripOk" - Me.contextMenuStripOptions.Size = New System.Drawing.Size(181, 136) + Me.contextMenuStripOptions.Size = New System.Drawing.Size(172, 114) ' 'toolStripMenuItemPlotOptions ' Me.toolStripMenuItemPlotOptions.Name = "toolStripMenuItemPlotOptions" - Me.toolStripMenuItemPlotOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemPlotOptions.Size = New System.Drawing.Size(171, 22) Me.toolStripMenuItemPlotOptions.Text = "Plot Options" ' 'toolStripMenuItemPointOptions ' Me.toolStripMenuItemPointOptions.Name = "toolStripMenuItemPointOptions" - Me.toolStripMenuItemPointOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemPointOptions.Size = New System.Drawing.Size(171, 22) Me.toolStripMenuItemPointOptions.Text = "Point Options" ' 'toolStripMenuItemRugOptions ' Me.toolStripMenuItemRugOptions.Name = "toolStripMenuItemRugOptions" - Me.toolStripMenuItemRugOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemRugOptions.Size = New System.Drawing.Size(171, 22) Me.toolStripMenuItemRugOptions.Text = "Rug Options" ' 'toolStripMenuItemSmoothOptions ' Me.toolStripMenuItemSmoothOptions.Name = "toolStripMenuItemSmoothOptions" - Me.toolStripMenuItemSmoothOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemSmoothOptions.Size = New System.Drawing.Size(171, 22) Me.toolStripMenuItemSmoothOptions.Text = "Smooth Options" ' + 'toolStripMenuItemTextrepelOptions + ' + Me.toolStripMenuItemTextrepelOptions.Name = "toolStripMenuItemTextrepelOptions" + Me.toolStripMenuItemTextrepelOptions.Size = New System.Drawing.Size(171, 22) + Me.toolStripMenuItemTextrepelOptions.Text = "Text_repel Options" + ' 'cmdOptions ' Me.cmdOptions.AutoSize = True @@ -227,7 +238,7 @@ Partial Class dlgScatterPlot 'ucrSaveScatterPlot ' Me.ucrSaveScatterPlot.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveScatterPlot.Location = New System.Drawing.Point(10, 322) + Me.ucrSaveScatterPlot.Location = New System.Drawing.Point(10, 346) 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) @@ -288,23 +299,75 @@ Partial Class dlgScatterPlot ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 353) + Me.ucrBase.Location = New System.Drawing.Point(10, 377) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 17 ' - 'toolStripMenuItemTextrepelOptions - ' - Me.toolStripMenuItemTextrepelOptions.Name = "toolStripMenuItemTextrepelOptions" - Me.toolStripMenuItemTextrepelOptions.Size = New System.Drawing.Size(180, 22) - Me.toolStripMenuItemTextrepelOptions.Text = "Text_repel Options" + 'lblWidth + ' + Me.lblWidth.AutoSize = True + Me.lblWidth.Location = New System.Drawing.Point(111, 314) + Me.lblWidth.Name = "lblWidth" + Me.lblWidth.Size = New System.Drawing.Size(38, 13) + Me.lblWidth.TabIndex = 19 + Me.lblWidth.Text = "Width:" + ' + 'ucrNudWidth + ' + Me.ucrNudWidth.AutoSize = True + Me.ucrNudWidth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudWidth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudWidth.Location = New System.Drawing.Point(152, 312) + Me.ucrNudWidth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudWidth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudWidth.Name = "ucrNudWidth" + Me.ucrNudWidth.Size = New System.Drawing.Size(45, 20) + Me.ucrNudWidth.TabIndex = 20 + Me.ucrNudWidth.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrChkJitter + ' + Me.ucrChkJitter.AutoSize = True + Me.ucrChkJitter.Checked = False + Me.ucrChkJitter.Location = New System.Drawing.Point(10, 312) + Me.ucrChkJitter.Name = "ucrChkJitter" + Me.ucrChkJitter.Size = New System.Drawing.Size(89, 23) + Me.ucrChkJitter.TabIndex = 18 + ' + 'lblHeith + ' + Me.lblHeith.AutoSize = True + Me.lblHeith.Location = New System.Drawing.Point(221, 314) + Me.lblHeith.Name = "lblHeith" + Me.lblHeith.Size = New System.Drawing.Size(41, 13) + Me.lblHeith.TabIndex = 21 + Me.lblHeith.Text = "Heigth:" + ' + 'ucrNudHeigth + ' + Me.ucrNudHeigth.AutoSize = True + Me.ucrNudHeigth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudHeigth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudHeigth.Location = New System.Drawing.Point(262, 312) + Me.ucrNudHeigth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudHeigth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudHeigth.Name = "ucrNudHeigth" + Me.ucrNudHeigth.Size = New System.Drawing.Size(45, 20) + Me.ucrNudHeigth.TabIndex = 22 + Me.ucrNudHeigth.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' '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(477, 412) + Me.ClientSize = New System.Drawing.Size(477, 438) + Me.Controls.Add(Me.lblHeith) + Me.Controls.Add(Me.ucrNudHeigth) + Me.Controls.Add(Me.lblWidth) + Me.Controls.Add(Me.ucrNudWidth) + Me.Controls.Add(Me.ucrChkJitter) Me.Controls.Add(Me.cmdOptions) Me.Controls.Add(Me.ucrInputSides) Me.Controls.Add(Me.lblSides) @@ -359,4 +422,9 @@ Partial Class dlgScatterPlot Friend WithEvents toolStripMenuItemRugOptions As ToolStripMenuItem Friend WithEvents toolStripMenuItemSmoothOptions As ToolStripMenuItem Friend WithEvents toolStripMenuItemTextrepelOptions As ToolStripMenuItem + Friend WithEvents lblHeith As Label + Friend WithEvents ucrNudHeigth As ucrNud + Friend WithEvents lblWidth As Label + Friend WithEvents ucrNudWidth As ucrNud + Friend WithEvents ucrChkJitter As ucrCheck End Class diff --git a/instat/dlgScatterPlot.vb b/instat/dlgScatterPlot.vb index ef3c9801f66..59c086ee526 100644 --- a/instat/dlgScatterPlot.vb +++ b/instat/dlgScatterPlot.vb @@ -42,6 +42,8 @@ Public Class dlgScatterPlot Private clsScaleColourViridisFunction As New RFunction Private clsAnnotateFunction As New RFunction Private clsGeomRugFunction As New RFunction + Private clsGeomJitterFunction As New RFunction + Private clsPositionJitterFunction As New RFunction 'Parameter names for geoms Private strFirstParameterName As String = "geomfunc" Private strGeomSmoothParameterName As String = "geom_smooth" @@ -117,6 +119,11 @@ Public Class dlgScatterPlot ucrChkAddRugPlot.AddParameterPresentCondition(False, "geom_rug", False) ucrChkAddRugPlot.AddToLinkedControls({ucrNudSize, ucrInputSides}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrChkJitter.SetText("Jitter") + ucrChkJitter.AddParameterPresentCondition(True, " geom_jitter") + ucrChkJitter.AddParameterPresentCondition(False, " geom_jitter", False) + ucrChkJitter.AddToLinkedControls({ucrNudHeigth, ucrNudWidth}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="0.40") + ucrSaveScatterPlot.SetPrefix("scatter_plot") ucrSaveScatterPlot.SetSaveType(strRObjectType:=RObjectTypeLabel.Graph, strRObjectFormat:=RObjectFormat.Image) @@ -129,6 +136,18 @@ Public Class dlgScatterPlot ucrNudSize.Increment = 0.1 ucrNudSize.DecimalPlaces = 1 + ucrNudHeigth.SetParameter(New RParameter("height", 5)) + ucrNudHeigth.Maximum = 0.5 + ucrNudHeigth.Minimum = 0.00 + ucrNudHeigth.Increment = 0.01 + ucrNudHeigth.DecimalPlaces = 2 + + ucrNudWidth.SetParameter(New RParameter("width", 6)) + ucrNudWidth.Maximum = 0.5 + ucrNudWidth.Minimum = 0.00 + ucrNudWidth.Increment = 0.01 + ucrNudWidth.DecimalPlaces = 2 + ucrInputSides.SetParameter(New RParameter("sides", 1)) dctSidesOptions.Add("Bottom and left", Chr(34) & "bl" & Chr(34)) dctSidesOptions.Add("Top, right and bottom", Chr(34) & "trb" & Chr(34)) @@ -149,6 +168,8 @@ Public Class dlgScatterPlot ucrInputSides.SetDropDownStyleAsNonEditable() ucrNudSize.SetLinkedDisplayControl(lblSize) + ucrNudWidth.SetLinkedDisplayControl(lblWidth) + ucrNudHeigth.SetLinkedDisplayControl(lblHeith) ucrInputSides.SetLinkedDisplayControl(lblSides) End Sub @@ -160,6 +181,8 @@ Public Class dlgScatterPlot clsRaesFunction = New RFunction clsGeomSmoothFunction = New RFunction clsGeomRugFunction = New RFunction + clsGeomJitterFunction = New RFunction + clsPositionJitterFunction = New RFunction ucrSelectorForScatter.Reset() ucrSelectorForScatter.SetGgplotFunction(clsBaseOperator) @@ -196,6 +219,14 @@ Public Class dlgScatterPlot clsGeomRugFunction.SetRCommand("geom_rug") clsGeomRugFunction.AddParameter("size", 0.5, iPosition:=0) + clsPositionJitterFunction.SetRCommand("position_jitter") + clsPositionJitterFunction.AddParameter("width", 0.4, iPosition:=0) + clsPositionJitterFunction.AddParameter("height", 0.4, iPosition:=1) + + clsGeomJitterFunction.SetPackageName("ggplot2") + clsGeomJitterFunction.SetRCommand("geom_jitter") + clsGeomJitterFunction.AddParameter("position", clsRFunctionParameter:=clsPositionJitterFunction, iPosition:=0) + clsBaseOperator.AddParameter(GgplotDefaults.clsDefaultThemeParameter.Clone()) clsXlabsFunction = GgplotDefaults.clsXlabTitleFunction.Clone() clsYlabsFunction = GgplotDefaults.clsYlabTitleFunction.Clone() @@ -239,6 +270,11 @@ Public Class dlgScatterPlot ucrChkWithSE.SetRCode(clsGeomSmoothFunction, bReset) ucrChkAddRugPlot.SetRCode(clsBaseOperator, bReset) ucrNudSize.SetRCode(clsGeomRugFunction, bReset) + If bReset Then + ucrChkJitter.SetRCode(clsGeomJitterFunction, bReset) + End If + ucrNudHeigth.SetRCode(clsPositionJitterFunction, bReset) + ucrNudWidth.SetRCode(clsPositionJitterFunction, bReset) ucrInputSides.SetRCode(clsGeomRugFunction, bReset) End Sub @@ -355,4 +391,16 @@ Public Class dlgScatterPlot End If toolStripMenuItemTextrepelOptions.Enabled = Not ucrReceiverLabel.IsEmpty End Sub + + Private Sub ucrChkJitter_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkJitter.ControlValueChanged + If ucrChkJitter.Checked Then + clsPositionJitterFunction.AddParameter("width", ucrNudWidth.GetText, iPosition:=0) + clsPositionJitterFunction.AddParameter("height", ucrNudHeigth.GetText, iPosition:=1) + clsBaseOperator.AddParameter("geom_jitter", clsRFunctionParameter:=clsGeomJitterFunction, iPosition:=2) + clsBaseOperator.RemoveParameterByName(strFirstParameterName) + Else + clsBaseOperator.AddParameter(strFirstParameterName, clsRFunctionParameter:=clsRScatterGeomFunction, iPosition:=2) + clsBaseOperator.RemoveParameterByName("geom_jitter") + End If + End Sub End Class From d4162aa0c4e255eebefff9149eae199458853b66 Mon Sep 17 00:00:00 2001 From: Sophie Malla Tatchum Date: Tue, 5 Sep 2023 13:54:31 +0100 Subject: [PATCH 2/4] minor change --- instat/dlgScatterPlot.Designer.vb | 138 ++++++++++++++++-------------- instat/dlgScatterPlot.vb | 48 ++++++----- 2 files changed, 98 insertions(+), 88 deletions(-) diff --git a/instat/dlgScatterPlot.Designer.vb b/instat/dlgScatterPlot.Designer.vb index 8f451775273..614b377b877 100644 --- a/instat/dlgScatterPlot.Designer.vb +++ b/instat/dlgScatterPlot.Designer.vb @@ -50,6 +50,12 @@ Partial Class dlgScatterPlot Me.toolStripMenuItemRugOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemSmoothOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemTextrepelOptions = New System.Windows.Forms.ToolStripMenuItem() + Me.toolStripMenuItemJitterOptions = New System.Windows.Forms.ToolStripMenuItem() + Me.lblWidth = New System.Windows.Forms.Label() + Me.lblHeith = New System.Windows.Forms.Label() + Me.ucrNudHeigth = New instat.ucrNud() + Me.ucrNudWidth = New instat.ucrNud() + Me.ucrChkJitter = New instat.ucrCheck() Me.cmdOptions = New instat.ucrSplitButton() Me.ucrInputSides = New instat.ucrInputComboBox() Me.ucrNudSize = New instat.ucrNud() @@ -63,11 +69,6 @@ Partial Class dlgScatterPlot Me.ucrFactorOptionalReceiver = New instat.ucrReceiverSingle() Me.ucrReceiverX = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() - Me.lblWidth = New System.Windows.Forms.Label() - Me.ucrNudWidth = New instat.ucrNud() - Me.ucrChkJitter = New instat.ucrCheck() - Me.lblHeith = New System.Windows.Forms.Label() - Me.ucrNudHeigth = New instat.ucrNud() Me.contextMenuStripOptions.SuspendLayout() Me.SuspendLayout() ' @@ -124,40 +125,99 @@ Partial Class dlgScatterPlot ' 'contextMenuStripOptions ' - Me.contextMenuStripOptions.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripMenuItemPlotOptions, Me.toolStripMenuItemPointOptions, Me.toolStripMenuItemRugOptions, Me.toolStripMenuItemSmoothOptions, Me.toolStripMenuItemTextrepelOptions}) + Me.contextMenuStripOptions.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripMenuItemPlotOptions, Me.toolStripMenuItemPointOptions, Me.toolStripMenuItemRugOptions, Me.toolStripMenuItemSmoothOptions, Me.toolStripMenuItemTextrepelOptions, Me.toolStripMenuItemJitterOptions}) Me.contextMenuStripOptions.Name = "contextMenuStripOk" - Me.contextMenuStripOptions.Size = New System.Drawing.Size(172, 114) + Me.contextMenuStripOptions.Size = New System.Drawing.Size(181, 158) ' 'toolStripMenuItemPlotOptions ' Me.toolStripMenuItemPlotOptions.Name = "toolStripMenuItemPlotOptions" - Me.toolStripMenuItemPlotOptions.Size = New System.Drawing.Size(171, 22) + Me.toolStripMenuItemPlotOptions.Size = New System.Drawing.Size(180, 22) Me.toolStripMenuItemPlotOptions.Text = "Plot Options" ' 'toolStripMenuItemPointOptions ' Me.toolStripMenuItemPointOptions.Name = "toolStripMenuItemPointOptions" - Me.toolStripMenuItemPointOptions.Size = New System.Drawing.Size(171, 22) + Me.toolStripMenuItemPointOptions.Size = New System.Drawing.Size(180, 22) Me.toolStripMenuItemPointOptions.Text = "Point Options" ' 'toolStripMenuItemRugOptions ' Me.toolStripMenuItemRugOptions.Name = "toolStripMenuItemRugOptions" - Me.toolStripMenuItemRugOptions.Size = New System.Drawing.Size(171, 22) + Me.toolStripMenuItemRugOptions.Size = New System.Drawing.Size(180, 22) Me.toolStripMenuItemRugOptions.Text = "Rug Options" ' 'toolStripMenuItemSmoothOptions ' Me.toolStripMenuItemSmoothOptions.Name = "toolStripMenuItemSmoothOptions" - Me.toolStripMenuItemSmoothOptions.Size = New System.Drawing.Size(171, 22) + Me.toolStripMenuItemSmoothOptions.Size = New System.Drawing.Size(180, 22) Me.toolStripMenuItemSmoothOptions.Text = "Smooth Options" ' 'toolStripMenuItemTextrepelOptions ' Me.toolStripMenuItemTextrepelOptions.Name = "toolStripMenuItemTextrepelOptions" - Me.toolStripMenuItemTextrepelOptions.Size = New System.Drawing.Size(171, 22) + Me.toolStripMenuItemTextrepelOptions.Size = New System.Drawing.Size(180, 22) Me.toolStripMenuItemTextrepelOptions.Text = "Text_repel Options" ' + 'toolStripMenuItemJitterOptions + ' + Me.toolStripMenuItemJitterOptions.Name = "toolStripMenuItemJitterOptions" + Me.toolStripMenuItemJitterOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemJitterOptions.Text = "Jitter Options" + ' + 'lblWidth + ' + Me.lblWidth.AutoSize = True + Me.lblWidth.Location = New System.Drawing.Point(111, 314) + Me.lblWidth.Name = "lblWidth" + Me.lblWidth.Size = New System.Drawing.Size(38, 13) + Me.lblWidth.TabIndex = 19 + Me.lblWidth.Text = "Width:" + ' + 'lblHeith + ' + Me.lblHeith.AutoSize = True + Me.lblHeith.Location = New System.Drawing.Point(221, 314) + Me.lblHeith.Name = "lblHeith" + Me.lblHeith.Size = New System.Drawing.Size(41, 13) + Me.lblHeith.TabIndex = 21 + Me.lblHeith.Text = "Heigth:" + ' + 'ucrNudHeigth + ' + Me.ucrNudHeigth.AutoSize = True + Me.ucrNudHeigth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudHeigth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudHeigth.Location = New System.Drawing.Point(262, 312) + Me.ucrNudHeigth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudHeigth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudHeigth.Name = "ucrNudHeigth" + Me.ucrNudHeigth.Size = New System.Drawing.Size(45, 20) + Me.ucrNudHeigth.TabIndex = 22 + Me.ucrNudHeigth.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudWidth + ' + Me.ucrNudWidth.AutoSize = True + Me.ucrNudWidth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudWidth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudWidth.Location = New System.Drawing.Point(152, 312) + Me.ucrNudWidth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudWidth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudWidth.Name = "ucrNudWidth" + Me.ucrNudWidth.Size = New System.Drawing.Size(45, 20) + Me.ucrNudWidth.TabIndex = 20 + Me.ucrNudWidth.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrChkJitter + ' + Me.ucrChkJitter.AutoSize = True + Me.ucrChkJitter.Checked = False + Me.ucrChkJitter.Location = New System.Drawing.Point(10, 312) + Me.ucrChkJitter.Name = "ucrChkJitter" + Me.ucrChkJitter.Size = New System.Drawing.Size(89, 23) + Me.ucrChkJitter.TabIndex = 18 + ' 'cmdOptions ' Me.cmdOptions.AutoSize = True @@ -304,59 +364,6 @@ Partial Class dlgScatterPlot Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 17 ' - 'lblWidth - ' - Me.lblWidth.AutoSize = True - Me.lblWidth.Location = New System.Drawing.Point(111, 314) - Me.lblWidth.Name = "lblWidth" - Me.lblWidth.Size = New System.Drawing.Size(38, 13) - Me.lblWidth.TabIndex = 19 - Me.lblWidth.Text = "Width:" - ' - 'ucrNudWidth - ' - Me.ucrNudWidth.AutoSize = True - Me.ucrNudWidth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudWidth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudWidth.Location = New System.Drawing.Point(152, 312) - Me.ucrNudWidth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudWidth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudWidth.Name = "ucrNudWidth" - Me.ucrNudWidth.Size = New System.Drawing.Size(45, 20) - Me.ucrNudWidth.TabIndex = 20 - Me.ucrNudWidth.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' - 'ucrChkJitter - ' - Me.ucrChkJitter.AutoSize = True - Me.ucrChkJitter.Checked = False - Me.ucrChkJitter.Location = New System.Drawing.Point(10, 312) - Me.ucrChkJitter.Name = "ucrChkJitter" - Me.ucrChkJitter.Size = New System.Drawing.Size(89, 23) - Me.ucrChkJitter.TabIndex = 18 - ' - 'lblHeith - ' - Me.lblHeith.AutoSize = True - Me.lblHeith.Location = New System.Drawing.Point(221, 314) - Me.lblHeith.Name = "lblHeith" - Me.lblHeith.Size = New System.Drawing.Size(41, 13) - Me.lblHeith.TabIndex = 21 - Me.lblHeith.Text = "Heigth:" - ' - 'ucrNudHeigth - ' - Me.ucrNudHeigth.AutoSize = True - Me.ucrNudHeigth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudHeigth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudHeigth.Location = New System.Drawing.Point(262, 312) - Me.ucrNudHeigth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudHeigth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudHeigth.Name = "ucrNudHeigth" - Me.ucrNudHeigth.Size = New System.Drawing.Size(45, 20) - Me.ucrNudHeigth.TabIndex = 22 - Me.ucrNudHeigth.Value = New Decimal(New Integer() {0, 0, 0, 0}) - ' 'dlgScatterPlot ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) @@ -427,4 +434,5 @@ Partial Class dlgScatterPlot Friend WithEvents lblWidth As Label Friend WithEvents ucrNudWidth As ucrNud Friend WithEvents ucrChkJitter As ucrCheck + Friend WithEvents toolStripMenuItemJitterOptions As ToolStripMenuItem End Class diff --git a/instat/dlgScatterPlot.vb b/instat/dlgScatterPlot.vb index 59c086ee526..5916472cb65 100644 --- a/instat/dlgScatterPlot.vb +++ b/instat/dlgScatterPlot.vb @@ -43,12 +43,12 @@ Public Class dlgScatterPlot Private clsAnnotateFunction As New RFunction Private clsGeomRugFunction As New RFunction Private clsGeomJitterFunction As New RFunction - Private clsPositionJitterFunction As New RFunction 'Parameter names for geoms Private strFirstParameterName As String = "geomfunc" Private strGeomSmoothParameterName As String = "geom_smooth" Private strGeomTextRepelParameterName As String = "geom_text_repel" - Private strGeomParameterNames() As String = {strFirstParameterName, strGeomSmoothParameterName, strGeomTextRepelParameterName} + Private strGeomJitterParameterName As String = "geom_jitter" + Private strGeomParameterNames() As String = {strFirstParameterName, strGeomJitterParameterName, strGeomSmoothParameterName, strGeomTextRepelParameterName} Private Sub dlgScatterPlot_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -182,7 +182,6 @@ Public Class dlgScatterPlot clsGeomSmoothFunction = New RFunction clsGeomRugFunction = New RFunction clsGeomJitterFunction = New RFunction - clsPositionJitterFunction = New RFunction ucrSelectorForScatter.Reset() ucrSelectorForScatter.SetGgplotFunction(clsBaseOperator) @@ -195,6 +194,7 @@ Public Class dlgScatterPlot toolStripMenuItemRugOptions.Enabled = False toolStripMenuItemSmoothOptions.Enabled = False toolStripMenuItemTextrepelOptions.Enabled = False + toolStripMenuItemJitterOptions.Enabled = False clsBaseOperator.SetOperation("+") clsBaseOperator.AddParameter("ggplot", clsRFunctionParameter:=clsRggplotFunction, iPosition:=0) @@ -219,13 +219,10 @@ Public Class dlgScatterPlot clsGeomRugFunction.SetRCommand("geom_rug") clsGeomRugFunction.AddParameter("size", 0.5, iPosition:=0) - clsPositionJitterFunction.SetRCommand("position_jitter") - clsPositionJitterFunction.AddParameter("width", 0.4, iPosition:=0) - clsPositionJitterFunction.AddParameter("height", 0.4, iPosition:=1) - clsGeomJitterFunction.SetPackageName("ggplot2") clsGeomJitterFunction.SetRCommand("geom_jitter") - clsGeomJitterFunction.AddParameter("position", clsRFunctionParameter:=clsPositionJitterFunction, iPosition:=0) + clsGeomJitterFunction.AddParameter("width", 0.4, iPosition:=0) + clsGeomJitterFunction.AddParameter("height", 0.4, iPosition:=1) clsBaseOperator.AddParameter(GgplotDefaults.clsDefaultThemeParameter.Clone()) clsXlabsFunction = GgplotDefaults.clsXlabTitleFunction.Clone() @@ -271,10 +268,10 @@ Public Class dlgScatterPlot ucrChkAddRugPlot.SetRCode(clsBaseOperator, bReset) ucrNudSize.SetRCode(clsGeomRugFunction, bReset) If bReset Then - ucrChkJitter.SetRCode(clsGeomJitterFunction, bReset) + ucrChkJitter.SetRCode(clsBaseOperator, bReset) End If - ucrNudHeigth.SetRCode(clsPositionJitterFunction, bReset) - ucrNudWidth.SetRCode(clsPositionJitterFunction, bReset) + ucrNudHeigth.SetRCode(clsGeomJitterFunction, bReset) + ucrNudWidth.SetRCode(clsGeomJitterFunction, bReset) ucrInputSides.SetRCode(clsGeomRugFunction, bReset) End Sub @@ -311,6 +308,19 @@ Public Class dlgScatterPlot toolStripMenuItemRugOptions.Enabled = ucrChkAddRugPlot.Checked End Sub + Private Sub ucrChkJitter_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkJitter.ControlValueChanged + If ucrChkJitter.Checked Then + clsGeomJitterFunction.AddParameter("width", ucrNudWidth.GetText, iPosition:=0) + clsGeomJitterFunction.AddParameter("height", ucrNudHeigth.GetText, iPosition:=1) + clsBaseOperator.AddParameter(strGeomJitterParameterName, clsRFunctionParameter:=clsGeomJitterFunction, iPosition:=2) + clsBaseOperator.RemoveParameterByName(strFirstParameterName) + Else + clsBaseOperator.AddParameter(strFirstParameterName, clsRFunctionParameter:=clsRScatterGeomFunction, iPosition:=2) + clsBaseOperator.RemoveParameterByName(strGeomJitterParameterName) + End If + toolStripMenuItemJitterOptions.Enabled = ucrChkJitter.Checked + 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, @@ -340,6 +350,10 @@ Public Class dlgScatterPlot EnableDisableOptions(clsLabelFunction) End Sub + Private Sub toolStripMenuItemJitterOptions_Click(sender As Object, e As EventArgs) Handles toolStripMenuItemJitterOptions.Click + EnableDisableOptions(clsGeomJitterFunction) + End Sub + Private Sub EnableDisableOptions(clsTempFunction As RFunction) 'SetupLayer sends the components storing the plot info (clsRaesFunction, clsRggplotFunction, ...) of dlgScatteredPlot through to sdgLayerOptions where these will be edited. sdgLayerOptions.SetupLayer(clsNewGgPlot:=clsRggplotFunction, clsNewGeomFunc:=clsTempFunction, @@ -391,16 +405,4 @@ Public Class dlgScatterPlot End If toolStripMenuItemTextrepelOptions.Enabled = Not ucrReceiverLabel.IsEmpty End Sub - - Private Sub ucrChkJitter_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkJitter.ControlValueChanged - If ucrChkJitter.Checked Then - clsPositionJitterFunction.AddParameter("width", ucrNudWidth.GetText, iPosition:=0) - clsPositionJitterFunction.AddParameter("height", ucrNudHeigth.GetText, iPosition:=1) - clsBaseOperator.AddParameter("geom_jitter", clsRFunctionParameter:=clsGeomJitterFunction, iPosition:=2) - clsBaseOperator.RemoveParameterByName(strFirstParameterName) - Else - clsBaseOperator.AddParameter(strFirstParameterName, clsRFunctionParameter:=clsRScatterGeomFunction, iPosition:=2) - clsBaseOperator.RemoveParameterByName("geom_jitter") - End If - End Sub End Class From 6130dc81080bf151d2bb977b11af260e78d4bd7e Mon Sep 17 00:00:00 2001 From: MeSophie <106779233+MeSophie@users.noreply.github.com> Date: Wed, 6 Sep 2023 09:14:54 +0100 Subject: [PATCH 3/4] Update instat/dlgScatterPlot.vb Co-authored-by: lloyddewit <57253949+lloyddewit@users.noreply.github.com> --- instat/dlgScatterPlot.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/dlgScatterPlot.vb b/instat/dlgScatterPlot.vb index 5916472cb65..0e203d396ca 100644 --- a/instat/dlgScatterPlot.vb +++ b/instat/dlgScatterPlot.vb @@ -120,8 +120,8 @@ Public Class dlgScatterPlot ucrChkAddRugPlot.AddToLinkedControls({ucrNudSize, ucrInputSides}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrChkJitter.SetText("Jitter") - ucrChkJitter.AddParameterPresentCondition(True, " geom_jitter") - ucrChkJitter.AddParameterPresentCondition(False, " geom_jitter", False) + ucrChkJitter.AddParameterPresentCondition(True, "geom_jitter") + ucrChkJitter.AddParameterPresentCondition(False, "geom_jitter", False) ucrChkJitter.AddToLinkedControls({ucrNudHeigth, ucrNudWidth}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="0.40") ucrSaveScatterPlot.SetPrefix("scatter_plot") From 3cafbab344548d5b62cf19553d6b83386a23d2e1 Mon Sep 17 00:00:00 2001 From: MeSophie <106779233+MeSophie@users.noreply.github.com> Date: Wed, 6 Sep 2023 09:15:31 +0100 Subject: [PATCH 4/4] Update instat/dlgScatterPlot.vb Co-authored-by: lloyddewit <57253949+lloyddewit@users.noreply.github.com> --- instat/dlgScatterPlot.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instat/dlgScatterPlot.vb b/instat/dlgScatterPlot.vb index 0e203d396ca..51dd512edf0 100644 --- a/instat/dlgScatterPlot.vb +++ b/instat/dlgScatterPlot.vb @@ -138,13 +138,13 @@ Public Class dlgScatterPlot ucrNudHeigth.SetParameter(New RParameter("height", 5)) ucrNudHeigth.Maximum = 0.5 - ucrNudHeigth.Minimum = 0.00 + ucrNudHeigth.Minimum = 0 ucrNudHeigth.Increment = 0.01 ucrNudHeigth.DecimalPlaces = 2 ucrNudWidth.SetParameter(New RParameter("width", 6)) ucrNudWidth.Maximum = 0.5 - ucrNudWidth.Minimum = 0.00 + ucrNudWidth.Minimum = 0 ucrNudWidth.Increment = 0.01 ucrNudWidth.DecimalPlaces = 2