Skip to content

Commit

Permalink
working save control and use in one variable graph
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyparsons committed Jan 25, 2017
1 parent b1ad25a commit fa09a79
Show file tree
Hide file tree
Showing 5 changed files with 327 additions and 87 deletions.
106 changes: 53 additions & 53 deletions instat/dlgOneVariableGraph.Designer.vb

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

44 changes: 15 additions & 29 deletions instat/dlgOneVariableGraph.vb
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ Public Class dlgOneVariableGraph
ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultRFunction.Clone())

ucrSelectorOneVarGraph.Reset()
ucrOneVarGraphSave.Reset()
ucrOneVarGraphSave.strPrefix = "OneVariableGraph"

SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, True)
bResetSubdialog = True
TestOkEnabled()
End Sub

Private Sub InitialiseDialog()
ucrBase.iHelpTopicID = 412
ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False
ucrBase.clsRsyntax.iCallType = 3

ucrPnlOutput.SetParameter(New RParameter("output"))
ucrPnlOutput.AddRadioButton(rdoFacets, Chr(34) & "facets" & Chr(34))
ucrPnlOutput.AddRadioButton(rdoCombine, Chr(34) & "combine" & Chr(34))
Expand All @@ -65,31 +66,31 @@ Public Class dlgOneVariableGraph
ucrChkFlip.SetValuesCheckedAndUnchecked("TRUE", "FALSE")
ucrChkFlip.SetDefault("FALSE")

ucrBase.iHelpTopicID = 412
ucrOneVarGraphSave.strPrefix = "OneVariableGraph"
ucrOneVarGraphSave.SetDataFrameSelector(ucrSelectorOneVarGraph.ucrAvailableDataFrames)
ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False
ucrBase.clsRsyntax.iCallType = 3
ucrSaveGraph.SetPrefix("OneVariableGraph")
ucrSaveGraph.SetSaveType("graph")
ucrSaveGraph.SetDataFrameSelector(ucrSelectorOneVarGraph.ucrAvailableDataFrames)
ucrSaveGraph.SetCheckBoxText("Save Graph")
ucrSaveGraph.SetIsComboBox(True)
ucrSaveGraph.SetAssignToIfUncheckedValue("last_graph")

'Define the default RFunction
clsDefaultRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$graph_one_variable")
clsDefaultRFunction.AddParameter("numeric", Chr(34) & "geom_boxplot" & Chr(34))
clsDefaultRFunction.AddParameter("categorical", Chr(34) & "geom_bar" & Chr(34))
clsDefaultRFunction.AddParameter("output", Chr(34) & "facets" & Chr(34))
clsDefaultRFunction.AddParameter(ucrSelectorOneVarGraph.GetParameter(), 0)
clsDefaultRFunction.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorOneVarGraph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph")
End Sub

Private Sub ReopenDialog()
CheckDataType()
End Sub

Private Sub TestOkEnabled()
'Question: What should TestOK do in the new implementation? Still check controls or check the code?
'this test when to enable okay button. Should be enabled only when the receiver is not empty or when the save graph is schecked and the save graph is not empty
If ucrReceiverOneVarGraph.IsEmpty() OrElse (ucrOneVarGraphSave.chkSaveGraph.Checked AndAlso ucrOneVarGraphSave.ucrInputGraphName.IsEmpty) Then
ucrBase.OKEnabled(False)
Else
If Not ucrReceiverOneVarGraph.IsEmpty() AndAlso ucrSaveGraph.IsComplete() Then
ucrBase.OKEnabled(True)
Else
ucrBase.OKEnabled(False)
End If
End Sub

Expand All @@ -98,16 +99,6 @@ Public Class dlgOneVariableGraph
TestOkEnabled()
End Sub

Private Sub ucrOneVarGraphSave_GraphNameChanged() Handles ucrOneVarGraphSave.GraphNameChanged, ucrOneVarGraphSave.SaveGraphCheckedChanged
'this sub saves graphs
If ucrOneVarGraphSave.bSaveGraph Then
ucrBase.clsRsyntax.SetAssignTo(ucrOneVarGraphSave.strGraphName, strTempDataframe:=ucrSelectorOneVarGraph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrOneVarGraphSave.strGraphName)
Else
ucrBase.clsRsyntax.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorOneVarGraph.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph")
End If
TestOkEnabled()
End Sub

Private Sub cmdGraph_Click(sender As Object, e As EventArgs) Handles cmdGraphOptions.Click
' Link the base function to the sub dialog
sdgOneVarGraph.SetRFunction(ucrBase.clsRsyntax.clsBaseFunction, bResetSubdialog)
Expand All @@ -127,15 +118,10 @@ Public Class dlgOneVariableGraph
End If
End Sub

Private Sub ucrOneVarGraphSave_ContentsChanged() Handles ucrOneVarGraphSave.ContentsChanged
TestOkEnabled()
End Sub

Private Sub AllControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSelectorOneVarGraph.ControlContentsChanged, ucrChkFlip.ControlContentsChanged, ucrReceiverOneVarGraph.ControlContentsChanged, ucrSelectorOneVarGraph.ControlContentsChanged
Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSelectorOneVarGraph.ControlContentsChanged, ucrReceiverOneVarGraph.ControlContentsChanged, ucrSelectorOneVarGraph.ControlContentsChanged, ucrSaveGraph.ControlContentsChanged
TestOkEnabled()
End Sub

'When any of the ucrCore controls have been changed we update the R Code to match the contents
Private Sub AllControls_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverOneVarGraph.ControlValueChanged
CheckDataType()
End Sub
Expand Down
2 changes: 1 addition & 1 deletion instat/sdgOneVarGraph.vb
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ Public Class sdgOneVarGraph
lstCategoricalPairs.Add(New KeyValuePair(Of String, String)("Dot Plot", Chr(34) & "geom_dotplot" & Chr(34)))
ucrInputCategorical.SetItems(lstCategoricalPairs)


SetParameter({ucrChkSpecifyLayout, ucrNudNumberofColumns}, New RParameter("ncol"))
ucrChkSpecifyLayout.SetText("Specify Layout")
ucrChkSpecifyLayout.bChangeParameterValue = False
ucrChkSpecifyLayout.AddToLinkedControls(ucrLinked:=ucrNudNumberofColumns, objValues:={True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)
ucrNudNumberofColumns.SetMinMax(1, 10)
ucrNudNumberofColumns.bAddRemoveParameter = False
ucrNudNumberofColumns.SetLabel(lblNumberofColumns)

ucrChkFreeScaleAxisforFacets.SetText("Free Scale Axis for Facets")
Expand Down
17 changes: 15 additions & 2 deletions instat/ucrSave.Designer.vb

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

Loading

0 comments on commit fa09a79

Please sign in to comment.