Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving barchart and histogram dialog #9294

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions instat/dlgBarAndPieChart.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 47 additions & 2 deletions instat/dlgBarAndPieChart.vb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Public Class dlgBarAndPieChart

ucrPnlOptions.AddToLinkedControls({ucrChkFlipCoordinates, ucrChkPolarCoordinates, ucrReceiverByFactor, ucrInputBarChartPositions, ucrChkAddLabelsText, ucrVariablesAsFactorForBarChart, ucrChkBacktoback}, {rdoFrequency, rdoValue}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlOptions.AddToLinkedControls({ucrReceiverX, ucrChkReorderValue, ucrInputAddReorder, ucrChkLollipop}, {rdoValue}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlOptions.AddToLinkedControls({ucrChkReorderFrequency, ucrInputAddReorder}, {rdoFrequency}, bNewLinkedHideIfParameterMissing:=True)
ucrPnlOptions.AddToLinkedControls({ucrChkReorderFrequency, ucrChkBinWidth, ucrInputAddReorder}, {rdoFrequency}, bNewLinkedHideIfParameterMissing:=True)
ucrPnlOptions.AddToLinkedControls({ucrReceiverArea, ucrReceiverFill, ucrChkLayout, ucrChkStart, ucrChkAddLabelsTreemap}, {rdoTreeMap}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrPnlOptions.AddToLinkedControls({ucrReceiverWordcloudAngle, ucrReceiverWordcloudColor, ucrReceiverWordcloudLabel, ucrReceiverWordcloudSize, ucrChkIncreaseSize}, {rdoWordCloud}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrReceiverByFactor.SetLinkedDisplayControl(lblByFactor)
Expand Down Expand Up @@ -301,6 +301,12 @@ Public Class dlgBarAndPieChart
ucrNudLollipopSize.Minimum = 1
ucrNudLollipopSize.Maximum = 15

ucrChkBinWidth.SetText("Binwidth")
ucrChkBinWidth.AddToLinkedControls({ucrInputWidth}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=1.5)

ucrInputWidth.SetParameter(New RParameter("binwidth", 3))
ucrInputWidth.SetValidationTypeAsNumeric()

ucrChkLollipop.SetText("Lollipop")
ucrChkLollipop.AddParameterPresentCondition(True, "geom_lollipop")
ucrChkLollipop.AddParameterPresentCondition(False, "geom_lollipop", False)
Expand Down Expand Up @@ -481,7 +487,6 @@ Public Class dlgBarAndPieChart
clsRgeomBarFunction.SetPackageName("ggplot2")
clsRgeomBarFunction.SetRCommand("geom_bar")
clsRgeomBarFunction.AddParameter("position", Chr(34) & "stack" & Chr(34), iPosition:=0)
clsRgeomBarFunction.AddParameter("stat", Chr(34) & "count" & Chr(34), iPosition:=1)

clsRggplotFunction.SetPackageName("ggplot2")
clsRggplotFunction.SetRCommand("ggplot")
Expand Down Expand Up @@ -641,6 +646,7 @@ Public Class dlgBarAndPieChart

clsBaseOperator.SetAssignTo("last_graph", strTempDataframe:=ucrBarChartSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph")
ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator)
HideShowWidth()
End Sub

Private Sub SetRCodeForControls(bReset As Boolean)
Expand Down Expand Up @@ -679,12 +685,15 @@ Public Class dlgBarAndPieChart
ucrChkReorderFrequency.SetRCode(clsDummyFunction, bReset)
ucrChkLegend.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True)
ucrInputLegendPosition.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True)
ucrInputWidth.SetRCode(clsRgeomBarFunction, bReset)

If bReset Then
ucrChkStart.SetRCode(clsGeomTreemapFunction, bReset)
ucrChkLayout.SetRCode(clsGeomTreemapFunction, bReset)
ucrChkIncreaseSize.SetRCode(clsScaleSizeAreaFunction, bReset)
ucrChkBinWidth.SetRCode(clsRgeomBarFunction, bReset)
End If
HideShowWidth()
End Sub

Private Sub TestOkEnabled()
Expand Down Expand Up @@ -1265,6 +1274,9 @@ Public Class dlgBarAndPieChart
ucrChkIncreaseSize.ControlValueChanged, ucrChkLollipop.ControlValueChanged
SetDialogOptions()
ChangeParameterName()
AddStatsParm()
HideShowWidth()

If rdoTreeMap.Checked Then
ucrReceiverArea.SetMeAsReceiver()
ElseIf rdoWordCloud.Checked Then
Expand Down Expand Up @@ -1320,6 +1332,8 @@ Public Class dlgBarAndPieChart
End If
ChangeParameterName()
SetGeomTextOptions()
HideShowWidth()
AddStatsParm()
End Sub

Private Sub ucrChkPolarCoordinates_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkPolarCoordinates.ControlValueChanged, ucrPnlPolar.ControlValueChanged,
Expand Down Expand Up @@ -1396,4 +1410,35 @@ Public Class dlgBarAndPieChart
clsBaseOperator.RemoveParameterByName("geom_treemap_text")
End If
End Sub

Private Sub ucrChkBinWidth_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkBinWidth.ControlValueChanged, ucrInputWidth.ControlValueChanged, ucrVariablesAsFactorForBarChart.ControlValueChanged
If ucrChkBinWidth.Checked AndAlso ucrVariablesAsFactorForBarChart.ucrSingleVariable.strCurrDataType = "numeric" Then
clsRgeomBarFunction.AddParameter("binwidth", ucrInputWidth.GetText, iPosition:=4)
Else
clsRgeomBarFunction.RemoveParameterByName("binwidth")
End If
AddStatsParm()
HideShowWidth()
End Sub

Private Sub HideShowWidth()
ucrChkBinWidth.Visible = False
ucrInputWidth.Visible = False
If rdoFrequency.Checked AndAlso (Not ucrVariablesAsFactorForBarChart.IsEmpty AndAlso ucrVariablesAsFactorForBarChart.ucrSingleVariable.strCurrDataType = "numeric") Then
ucrChkBinWidth.Visible = True
ucrInputWidth.Visible = ucrChkBinWidth.Checked
Else
ucrChkBinWidth.Visible = False
ucrInputWidth.Visible = False
End If
End Sub

Private Sub AddStatsParm()
If rdoFrequency.Checked AndAlso ucrChkBinWidth.Checked AndAlso ucrVariablesAsFactorForBarChart.ucrSingleVariable.strCurrDataType = "numeric" Then
clsRgeomBarFunction.AddParameter("stat", Chr(34) & "bin" & Chr(34), iPosition:=1)
Else
clsRgeomBarFunction.AddParameter("stat", Chr(34) & "count" & Chr(34), iPosition:=1)
End If
End Sub

End Class
32 changes: 15 additions & 17 deletions instat/dlgHistogram.designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 10 additions & 14 deletions instat/dlgHistogram.vb
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,10 @@ Public Class dlgHistogram
ucrChkOmitYAxis.SetText("Omit Y Axis")

ucrChkBinWidth.SetText("Binwidth")
ucrChkBinWidth.AddToLinkedControls({ucrNudBinwidth}, {True}, bNewLinkedHideIfParameterMissing:=True)

ucrNudBinwidth.SetParameter(New RParameter("binwidth", 3))
ucrNudBinwidth.SetMinMax(0.00, 10.0)
ucrNudBinwidth.DecimalPlaces = 2
ucrNudBinwidth.Increment = 0.01
ucrNudBinwidth.SetRDefault(1.5)
ucrChkBinWidth.AddToLinkedControls({ucrInputWidth}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=1.5)

ucrInputWidth.SetParameter(New RParameter("binwidth", 3))
ucrInputWidth.SetValidationTypeAsNumeric()

ucrChkRidges.SetText("Density Ridges")
ucrChkRidges.AddFunctionNamesCondition(True, "geom_density_ridges")
Expand Down Expand Up @@ -327,7 +323,7 @@ Public Class dlgHistogram

ucrChkLegend.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True)
ucrInputLegendPosition.SetRCode(clsThemeFunction, bReset, bCloneIfNeeded:=True)
ucrNudBinwidth.SetRCode(clsRgeomPlotFunction, bReset)
ucrInputWidth.SetRCode(clsRgeomPlotFunction, bReset)
ucrNudMinHeight.SetRCode(clsRgeomPlotFunction, bReset)
ucrChkOmitYAxis.SetRCode(clsBaseOperator, bReset)
If bReset Then
Expand Down Expand Up @@ -493,7 +489,7 @@ Public Class dlgHistogram
End If
End Sub

Private Sub ucrPnlOptions_Control() Handles ucrPnlOptions.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged, ucrChkRidges.ControlValueChanged, ucrFactorReceiver.ControlValueChanged, ucrVariablesAsFactorforHist.ControlValueChanged, ucrInputAddReorder.ControlValueChanged, ucrChkOmitYAxis.ControlValueChanged, ucrNudBinwidth.ControlValueChanged
Private Sub ucrPnlOptions_Control() Handles ucrPnlOptions.ControlValueChanged, ucrChkDisplayAsDotPlot.ControlValueChanged, ucrChkRidges.ControlValueChanged, ucrFactorReceiver.ControlValueChanged, ucrVariablesAsFactorforHist.ControlValueChanged, ucrInputAddReorder.ControlValueChanged, ucrChkOmitYAxis.ControlValueChanged, ucrInputWidth.ControlValueChanged
toolStripMenuItemHistogramOptions.Enabled = rdoHistogram.Checked AndAlso Not ucrChkDisplayAsDotPlot.Checked
toolStripMenuItemDotOptions.Enabled = rdoHistogram.Checked AndAlso ucrChkDisplayAsDotPlot.Checked
toolStripMenuItemDensityOptions.Enabled = rdoDensity_ridges.Checked AndAlso Not ucrChkRidges.Checked
Expand Down Expand Up @@ -604,7 +600,7 @@ Public Class dlgHistogram
Me.ucrChkLegend.Location = New Point(11, 329)
Me.ucrChkBinWidth.Location = New Point(10, 262)
Me.ucrChkOmitYAxis.Location = New Point(10, 287)
Me.ucrNudBinwidth.Location = New Point(139, 262)
Me.ucrInputWidth.Location = New Point(139, 262)
Me.ucrInputStation.Location = New Point(318, 328)
Me.ucrInputLegendPosition.Location = New Point(87, 328)
Me.ucr1stFactorReceiver.Location = New Point(205, 329)
Expand All @@ -630,7 +626,7 @@ Public Class dlgHistogram
Me.ucrSaveHist.Location = New Point(10, 330)
Me.ucrChkBinWidth.Location = New Point(10, 262)
Me.ucrChkLegend.Location = New Point(11, 296)
Me.ucrNudBinwidth.Location = New Point(139, 262)
Me.ucrInputWidth.Location = New Point(139, 262)
Me.ucrInputStation.Location = New Point(318, 294)
Me.ucrInputLegendPosition.Location = New Point(87, 294)
Me.ucr1stFactorReceiver.Location = New Point(205, 296)
Expand Down Expand Up @@ -760,9 +756,9 @@ Public Class dlgHistogram

End Sub

Private Sub ucrChkBinWidth_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkBinWidth.ControlValueChanged, ucrNudBinwidth.ControlValueChanged
Private Sub ucrChkBinWidth_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkBinWidth.ControlValueChanged, ucrInputWidth.ControlValueChanged
If ucrChkBinWidth.Checked Then
clsRgeomPlotFunction.AddParameter("binwidth", ucrNudBinwidth.GetText, iPosition:=4)
clsRgeomPlotFunction.AddParameter("binwidth", ucrInputWidth.GetText, iPosition:=4)
Else
clsRgeomPlotFunction.RemoveParameterByName("binwidth")
End If
Expand Down Expand Up @@ -822,7 +818,7 @@ Public Class dlgHistogram
SetPipeAssignTo()
End Sub

Private Sub CoreControls_ControlContentsChanged() Handles ucrVariablesAsFactorforHist.ControlContentsChanged, ucrSaveHist.ControlContentsChanged, ucrFactorReceiver.ControlContentsChanged, ucrChkRidges.ControlContentsChanged, ucrInputAddReorder.ControlContentsChanged, ucrChkBinWidth.ControlContentsChanged, ucrNudBinwidth.ControlContentsChanged, ucrNudMinHeight.ControlContentsChanged
Private Sub CoreControls_ControlContentsChanged() Handles ucrVariablesAsFactorforHist.ControlContentsChanged, ucrSaveHist.ControlContentsChanged, ucrFactorReceiver.ControlContentsChanged, ucrChkRidges.ControlContentsChanged, ucrInputAddReorder.ControlContentsChanged, ucrChkBinWidth.ControlContentsChanged, ucrInputWidth.ControlContentsChanged, ucrNudMinHeight.ControlContentsChanged
TestOkEnabled()
End Sub
End Class
Loading