Skip to content

Commit

Permalink
changes to the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalis95 committed Feb 16, 2024
1 parent 05f1f8d commit 0bb39e6
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 14 deletions.
75 changes: 66 additions & 9 deletions instat/dlgScript.Designer.vb

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

40 changes: 35 additions & 5 deletions instat/dlgScript.vb
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ Public Class dlgScript
ucrChkOpenRFile.SetText("Open R File")

ucrInputGgplotify.SetLinkedDisplayControl(lblGraphObject)
ucrInputGraphCommand.SetLinkedDisplayControl(lblGraphCommand)

ucrPnlCommands.AddRadioButton(rdoCommandPackage)
ucrPnlCommands.AddRadioButton(rdoCommandObject)
ucrPnlCommands.AddRadioButton(rdoGgplotify)
ucrPnlCommands.AddRadioButton(rdoChooseFile)
ucrPnlCommands.AddRadioButton(rdoViewData)

'--------------------------------
'Get example controls
Expand Down Expand Up @@ -360,8 +362,11 @@ Public Class dlgScript
ucrCboCommandPackage.SetVisible(False)
ucrInputRemoveObjects.SetVisible(False)
ucrInputGgplotify.SetVisible(False)
ucrInputGraphCommand.SetVisible(False)
ucrChkOpenRFile.SetVisible(False)
ucrInputChooseFile.SetVisible(False)
ucrInputViewData.SetVisible(False)
rdoChooseFile.Enabled = False
If rdoCommandPackage.Checked Then
ucrCboCommandPackage.SetVisible(True)
ucrCboCommandPackage.OnControlValueChanged()
Expand All @@ -371,11 +376,15 @@ Public Class dlgScript
ElseIf rdoGgplotify.Checked Then
ucrInputGgplotify.SetVisible(True)
ucrInputGgplotify.OnControlValueChanged()
ucrInputGraphCommand.SetVisible(True)
ucrInputGraphCommand.OnControlValueChanged()
ElseIf rdoChooseFile.Checked Then
ucrChkOpenRFile.SetVisible(True)

ucrChkOpenRFile.OnControlValueChanged()
ucrInputChooseFile.OnControlValueChanged()
ElseIf rdoViewData.Checked Then
ucrInputViewData.SetVisible(True)
ucrInputViewData.OnControlValueChanged()
End If
End Sub

Expand Down Expand Up @@ -414,16 +423,22 @@ Public Class dlgScript
PreviewScript(strScript)
End Sub

Private Sub ucrInputGgplotify_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputGgplotify.ControlContentsChanged
Private Sub ucrInputGgplotify_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputGgplotify.ControlContentsChanged, ucrInputGraphCommand.ControlContentsChanged
Dim strScript As String = ""

If Not ucrInputGgplotify.IsEmpty() Then
If Not ucrInputGgplotify.IsEmpty() AndAlso Not ucrInputGraphCommand.IsEmpty Then
Dim clsGgglorifyFunction As New RFunction
Dim clsPlotFunction As New RFunction

clsGgglorifyFunction.SetPackageName("ggplotify")
clsGgglorifyFunction.SetRCommand("as.ggplot")

clsPlotFunction.SetRCommand("~plot")

Dim strAssignedScript As String = ""
clsGgglorifyFunction.SetAssignTo(ucrInputGgplotify.GetText & "_cols")
clsGgglorifyFunction.AddParameter("", "~")
clsPlotFunction.AddParameter("plot", ucrInputGraphCommand.GetText(), bIncludeArgumentName:=False)
clsGgglorifyFunction.SetAssignTo(ucrInputGgplotify.GetText)
clsGgglorifyFunction.AddParameter("", clsRFunctionParameter:=clsPlotFunction)
clsGgglorifyFunction.ToScript(strScript:=strAssignedScript)

strScript = "# Make Graph a ggplot " & Environment.NewLine & strAssignedScript
Expand All @@ -432,6 +447,21 @@ Public Class dlgScript
PreviewScript(strScript)
End Sub

Private Sub ucrInputViewData_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputViewData.ControlContentsChanged
Dim strScript As String = ""

If Not ucrInputViewData.IsEmpty Then
Dim clsViewDataFunction As New RFunction

clsViewDataFunction.SetRCommand("View")
clsViewDataFunction.AddParameter("view", ucrInputViewData.GetText(), bIncludeArgumentName:=False)

strScript = "#Show data in the R spreadsheet-type viewer" & Environment.NewLine & clsViewDataFunction.ToScript()

End If
PreviewScript(strScript)
End Sub

Private Sub ucrComboGetPackages_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrCboExamplePackages.ControlValueChanged, ucrPnlExample.ControlValueChanged
PreviewScript("")
lstExampleCollection.Items.Clear()
Expand Down

0 comments on commit 0bb39e6

Please sign in to comment.