Skip to content

Commit

Permalink
Merge pull request #42 from maxwellfundi/sdgplotss
Browse files Browse the repository at this point in the history
Sdgplotss
  • Loading branch information
bethanclarke authored Apr 25, 2018
2 parents 8a2da14 + 8d10bbf commit 401111e
Show file tree
Hide file tree
Showing 8 changed files with 628 additions and 212 deletions.
2 changes: 1 addition & 1 deletion instat/UcrGeomListWithAes.vb
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ Public Class ucrGeomListWithParameters

'Here the global ggplot function takes the relevant "mapping" and "data" parameters as required by "ApplyOnAllLayers".
clsGgplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsGlobalAesFunction, iPosition:=1)
clsGgplotFunction.AddParameter("data", clsRFunctionParameter:=ucrGeomWithAesSelector.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0)
clsGgplotFunction.AddParameter("data", clsRFunctionParameter:=ucrGeomWithAesSelector.ucrAvailableDataFrames.clsCurrDataFrame.Clone(), iPosition:=0)

strGlobalDataFrame = ucrGeomWithAesSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text
clsCurrentAesFunction = clsGlobalAesFunction
Expand Down
23 changes: 15 additions & 8 deletions instat/dlgColumnStructures.vb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Imports instat.Translations
Public Class dlgColumnStructure
Private bReset As Boolean = True
Private clsColourByMetadata, clsColumnStructure, clsUncolourByMetadata As New RFunction
'clsCourByStructure is here to construct the R-command that will colour columns according to their type in case it is required (see relevant tick box).
'this RFunction is just used for setting the appropriate RCODE of the ucrChkColourColumnsByStructure control
Private clsColourStructure As New RFunction
Private bFirstLoad As Boolean = True
Private Sub ucrSelectorColumnStructures_Load(sender As Object, e As EventArgs) Handles Me.Load
autoTranslate(Me)
Expand Down Expand Up @@ -59,13 +60,13 @@ Public Class dlgColumnStructure
ucrChkColourColumnsByStructure.SetText("Colour Columns by Structure")
ucrChkColourColumnsByStructure.AddFunctionNamesCondition(True, frmMain.clsRLink.strInstatDataObject & "$set_column_colours_by_metadata")
ucrChkColourColumnsByStructure.AddFunctionNamesCondition(False, frmMain.clsRLink.strInstatDataObject & "$remove_column_colours")
ucrChkColourColumnsByStructure.AddFunctionNamesCondition(True, frmMain.clsRLink.strInstatDataObject & "$remove_column_colours")
End Sub

Private Sub SetDefaults()
clsColourByMetadata = New RFunction
clsColumnStructure = New RFunction
clsUncolourByMetadata = New RFunction
clsColourStructure = clsUncolourByMetadata

ucrSelectorColumnStructure.Reset()
SetColumnStructureInReceiver()
Expand All @@ -89,7 +90,7 @@ Public Class dlgColumnStructure
ucrReceiverLayout.SetRCode(clsColumnStructure, bReset)
ucrReceiverTreatment.SetRCode(clsColumnStructure, bReset)
ucrReceiverMeasurement.SetRCode(clsColumnStructure, bReset)
ucrChkColourColumnsByStructure.SetRCode(clsUncolourByMetadata, bReset)
ucrChkColourColumnsByStructure.SetRCode(clsColourStructure, bReset)
End Sub

Private Sub TestOKEnabled()
Expand All @@ -100,18 +101,23 @@ Public Class dlgColumnStructure
End If
End Sub

Private Sub ucrChkColourColumnsByStructure_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkColourColumnsByStructure.ControlValueChanged
'assign the appropriate Colour Metadata RFunction to the clsColourStructure RFunction accordingly
If ucrChkColourColumnsByStructure.Checked Then
clsColourStructure = clsColourByMetadata
Else
clsColourStructure = clsUncolourByMetadata
End If
End Sub

Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset
SetDefaults()
SetRCodeForControls(True)
TestOKEnabled()
End Sub

Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk
If ucrChkColourColumnsByStructure.Checked Then
frmMain.clsRLink.RunScript(clsColourByMetadata.ToScript)
Else
frmMain.clsRLink.RunScript(clsUncolourByMetadata.ToScript)
End If
frmMain.clsRLink.RunScript(clsColourStructure.ToScript)
End Sub

Private Sub SetColumnStructureInReceiver()
Expand All @@ -126,4 +132,5 @@ Public Class dlgColumnStructure
Private Sub ucrSelectorColumnStructure_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrSelectorColumnStructure.ControlContentsChanged
TestOKEnabled()
End Sub

End Class
4 changes: 4 additions & 0 deletions instat/sdgLayerOptions.vb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ Public Class sdgLayerOptions
clsGeomFunction = clsNewGeomFunc
clsAesFunction = clsNewGlobalAesFunc
clsGgplotFunction = clsNewGgPlot
' This prevents ucrGeomWithAes affecting ucrLayerParameter before ucrLayerParameter.Setup has run
' Setup must be complete first so that controls are in sync
ucrLayerParameter.bPauseChanges = True
ucrGeomWithAes.Setup(clsNewGgPlot, clsNewGeomFunc, clsNewGlobalAesFunc, clsNewLocalAes, bFixGeom, ucrNewBaseSelector, bApplyAesGlobally, iNumVariablesForGeoms, bReset, strDataFrame)
ucrLayerParameter.bPauseChanges = False
ucrLayerParameter.Setup(clsNewGgPlot, clsNewGeomFunc, clsNewGlobalAesFunc, clsNewLocalAes, bFixGeom, ucrNewBaseSelector, bApplyAesGlobally, iNumVariablesForGeoms, bReset, strDataFrame)
End Sub

Expand Down
Loading

0 comments on commit 401111e

Please sign in to comment.