From cba11a6b8e3d226566d86d7d71544dfe8032d486 Mon Sep 17 00:00:00 2001 From: KWAMBAI VITALIS Date: Mon, 3 Jun 2024 14:36:26 +0300 Subject: [PATCH] changes to the code --- instat/dlgBoxPlot.vb | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/instat/dlgBoxPlot.vb b/instat/dlgBoxPlot.vb index d0f7c6a00a0..8b58288e336 100644 --- a/instat/dlgBoxPlot.vb +++ b/instat/dlgBoxPlot.vb @@ -125,7 +125,7 @@ Public Class dlgBoxplot ucrPnlPlots.AddFunctionNamesCondition(rdoBoxplotTufte, {"geom_boxplot", "geom_tufteboxplot"}) ucrPnlPlots.AddFunctionNamesCondition(rdoJitter, "geom_jitter") ucrPnlPlots.AddFunctionNamesCondition(rdoViolin, "geom_violin") - ucrPnlPlots.AddToLinkedControls({ucrChkAddPoints, ucrChkWidth}, {rdoBoxplotTufte, rdoViolin}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlPlots.AddToLinkedControls({ucrChkAddPoints}, {rdoBoxplotTufte, rdoViolin}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlPlots.AddToLinkedControls({ucrChkTufte}, {rdoBoxplotTufte}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrChkTufte.AddToLinkedControls(ucrChkVarWidth, {"FALSE"}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlPlots.AddToLinkedControls(ucrChkBoxPlot, {rdoJitter, rdoViolin}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) @@ -235,7 +235,7 @@ Public Class dlgBoxplot ucrInputStation.SetItems({strFacetWrap, strFacetRow, strFacetCol, strNone}) ucrInputStation.SetDropDownStyleAsNonEditable() - ucrChkWidth.SetText("Width") + ucrChkWidth.SetText("Cut Width") ucrChkWidth.AddToLinkedControls({ucrInputWidth}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=0.25) ucrChkWidth.AddParameterValuesCondition(True, "cut_width", "True") ucrChkWidth.AddParameterValuesCondition(False, "cut_width", "False") @@ -260,6 +260,7 @@ Public Class dlgBoxplot ucrChkGrouptoConnect.AddParameterPresentCondition(False, strStatSummaryParameterName, False) 'this control exists but diabled for now DialogueSize() + HideShowWidth() End Sub Private Sub SetDefaults() @@ -438,6 +439,7 @@ Public Class dlgBoxplot ucrChkBoxPlot.SetRCode(clsDummyFunction, bReset) ucrChkWidth.SetRCode(clsDummyFunction, bReset) End If + HideShowWidth() End Sub Private Sub TestOkEnabled() @@ -488,6 +490,8 @@ Public Class dlgBoxplot SetGeomPrefixFillColourAes() DialogueSize() EnableDisableBoxplotOptions() + HideShowWidth() + If rdoBoxplotTufte.Checked Then If ucrChkAddPoints.Checked Then clsBoxplotFunction.AddParameter("outlier.shape", "NA", iPosition:=2) @@ -732,6 +736,7 @@ Public Class dlgBoxplot AddRemoveGroupBy() EnableDisableWidth() AddRemoveAesParm() + HideShowWidth() End Sub Private Sub GetParameterValue(clsOperator As ROperator) @@ -805,22 +810,20 @@ Public Class dlgBoxplot clsCutWitdhFunction.RemoveParameterByName("var") End If EnableDisableWidth() + HideShowWidth() End Sub Private Sub ucrChkWidth_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkWidth.ControlValueChanged EnableDisableWidth() + HideShowWidth() End Sub Private Sub EnableDisableWidth() If ucrByFactorsReceiver.strCurrDataType = "Date" OrElse ucrByFactorsReceiver.strCurrDataType = "factor" OrElse ucrByFactorsReceiver.strCurrDataType = "orderded, factor" Then - ucrChkWidth.Enabled = False - ucrInputWidth.Enabled = False clsBoxplotFunction.RemoveParameterByName("aes") clsWidthRaesFunction.RemoveParameterByName("group") clsViolinplotFunction.RemoveParameterByName("aes") Else - ucrChkWidth.Enabled = True - ucrInputWidth.Enabled = True If ucrChkWidth.Checked AndAlso Not ucrByFactorsReceiver.IsEmpty Then clsWidthRaesFunction.AddParameter("group", clsRFunctionParameter:=clsCutWitdhFunction, iPosition:=1) clsBoxplotFunction.AddParameter("aes", clsRFunctionParameter:=clsWidthRaesFunction, bIncludeArgumentName:=False, iPosition:=1) @@ -833,6 +836,23 @@ Public Class dlgBoxplot End If End Sub + Private Sub HideShowWidth() + ucrChkWidth.Visible = False + ucrInputWidth.Visible = False + If rdoBoxplotTufte.Checked OrElse rdoViolin.Checked Then + If ucrByFactorsReceiver.strCurrDataType = "numeric" Then + ucrChkWidth.Visible = True + ucrInputWidth.Visible = ucrChkWidth.Checked + Else + ucrChkWidth.Visible = False + ucrInputWidth.Visible = False + End If + Else + ucrChkWidth.Visible = False + ucrInputWidth.Visible = False + End If + End Sub + Private Sub ucrChkBoxPlot_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkBoxPlot.ControlValueChanged, ucrNudBoxPlot.ControlValueChanged If ucrChkBoxPlot.Checked Then clsGeomBoxPlotFunction.AddParameter("width", ucrNudBoxPlot.GetText(), iPosition:=3)