Skip to content

Commit

Permalink
Merge pull request #4 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
updating master
  • Loading branch information
MeSophie authored Jul 15, 2022
2 parents 7ee717d + 09b57e8 commit 0d80c15
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
7 changes: 6 additions & 1 deletion instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,18 @@ Public Class RLink
' then assume command is not complete
Dim cLastChar As Char = strTrimmedLine.Last
Dim strLast3Chars As String = ""
Dim iNumOpenRound As Integer = strScriptCmd.Where(Function(c) c = "("c).Count
Dim iNumClosedRound As Integer = strScriptCmd.Where(Function(c) c = ")"c).Count
Dim iNumOpenCurlies As Integer = strScriptCmd.Where(Function(c) c = "{"c).Count
Dim iNumClosedCurlies As Integer = strScriptCmd.Where(Function(c) c = "}"c).Count
Dim iNumDoubleQuotes As Integer = strScriptCmd.Where(Function(c) c = """"c).Count
If strTrimmedLine.Length >= 3 Then
strLast3Chars = strTrimmedLine.Substring(strTrimmedLine.Length - 3)
End If
If cLastChar = "+" OrElse cLastChar = "," OrElse strLast3Chars = "%>%" OrElse iNumOpenCurlies <> iNumClosedCurlies OrElse iNumDoubleQuotes Mod 2 Then
If cLastChar = "+" OrElse cLastChar = "," OrElse strLast3Chars = "%>%" _
OrElse iNumOpenRound <> iNumClosedRound _
OrElse iNumOpenCurlies <> iNumClosedCurlies _
OrElse iNumDoubleQuotes Mod 2 Then
Continue For
End If

Expand Down
9 changes: 7 additions & 2 deletions instat/dlgPICSARainfall.vb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ Public Class dlgPICSARainfall
Private strLowerTercileName As String = ".lower_ter_y"
Private strUpperTercileName As String = ".upper_ter_y"

Private clsDummyFunction As New RFunction

Private clsAsDateYLimit As New RFunction
Private clsGeomHlineMean As New RFunction
Private clsGeomHlineMedian As New RFunction
Expand Down Expand Up @@ -220,6 +222,7 @@ Public Class dlgPICSARainfall
clsBaseOperator = New ROperator
clsGroupByFunction = New RFunction
clsMutateFunction = New RFunction
clsDummyFunction = New RFunction

clsRggplotFunction = New RFunction
clsGeomLine = New RFunction
Expand Down Expand Up @@ -292,6 +295,9 @@ Public Class dlgPICSARainfall
clsScaleColourViridisFunction = GgplotDefaults.clsScaleColorViridisFunction
clsAnnotateFunction = GgplotDefaults.clsAnnotateFunction

clsDummyFunction.AddParameter("upper_limit", "FALSE", iPosition:=0)
clsDummyFunction.AddParameter("lower_limit", "FALSE", iPosition:=1)

clsYScalecontinuousFunction.AddParameter("limits", clsRFunctionParameter:=clsCLimitsYContinuous, iPosition:=3)
clsCLimitsYContinuous.SetRCommand("c")
clsCLimitsYContinuous.AddParameter("lowerlimit", "NA", bIncludeArgumentName:=False, iPosition:=0)
Expand Down Expand Up @@ -796,7 +802,7 @@ Public Class dlgPICSARainfall
'add more functions
Private Sub cmdPICSAOptions_Click(sender As Object, e As EventArgs) Handles cmdPICSAOptions.Click
sdgPICSARainfallGraph.SetRCode(clsNewOperator:=ucrBase.clsRsyntax.clsBaseOperator, clsNewPipeOperator:=clsPipeOperator, clsNewStatRegEquation:=clsStatRegEquationFunction, clsNewStatsCorFunction:=clsStatsCorFunction,
dctNewThemeFunctions:=dctThemeFunctions, clsNewLabsFunction:=clsLabsFunction, clsNewThemeFunction:=clsThemeFunction,
dctNewThemeFunctions:=dctThemeFunctions, clsNewLabsFunction:=clsLabsFunction, clsNewThemeFunction:=clsThemeFunction, clsNewDummyFunction:=clsDummyFunction,
clsNewXScaleContinuousFunction:=clsXScalecontinuousFunction, clsNewYScaleContinuousFunction:=clsYScalecontinuousFunction,
clsNewGeomhlineMean:=clsGeomHlineMean, clsNewGeomhlineMedian:=clsGeomHlineMedian, clsNewGeomhlineLowerTercile:=clsGeomHlineLowerTercile,
clsNewGeomhlineUpperTercile:=clsGeomHlineUpperTercile, clsNewXLabsFunction:=clsXLabsFunction, clsNewYLabsFunction:=clsYLabsFunction,
Expand Down Expand Up @@ -882,7 +888,6 @@ Public Class dlgPICSARainfall
Private Sub YAxisDataTypeCheck()
If Not ucrVariablesAsFactorForPicsa.IsEmpty Then
clsGeomLine.AddParameter("group", 0)
clsBaseOperator.RemoveParameterByName("scale_y_continuous")
Else
clsGeomLine.RemoveParameterByName("group")
End If
Expand Down
19 changes: 11 additions & 8 deletions instat/sdgPICSARainfallGraph.vb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Public Class sdgPICSARainfallGraph
Private clsYElementTitle As New RFunction
Private clsXElementLabels As New RFunction
Private clsYElementLabels As New RFunction
Private clsDummyFunction As New RFunction
Private clsElementPanelGridMajor, clsElementPanelGridMinor As New RFunction
'Private clsPnlBackgroundElementRect As New RFunction
Private clsPanelBackgroundElementRect As New RFunction
Expand Down Expand Up @@ -225,8 +226,8 @@ Public Class sdgPICSARainfallGraph
ucrPnlYAxisType.AddToLinkedControls(ucrInputYSpecifyUpperLimitDateMonth, {rdoYDate}, bNewLinkedHideIfParameterMissing:=True)

ucrChkYSpecifyLowerLimit.SetText("Specify Lower Limit")
ucrChkYSpecifyLowerLimit.AddParameterValuesCondition(True, "lowerlimit", "NA", False)
ucrChkYSpecifyLowerLimit.AddParameterValuesCondition(False, "lowerlimit", "NA", True)
ucrChkYSpecifyLowerLimit.SetParameter(New RParameter("lower_limit", iNewPosition:=0))
ucrChkYSpecifyLowerLimit.SetValuesCheckedAndUnchecked("TRUE", "FALSE")
ucrChkYSpecifyLowerLimit.AddToLinkedControls(ucrInputYSpecifyLowerLimitNumeric, {True}, bNewLinkedHideIfParameterMissing:=True)

ucrInputYSpecifyLowerLimitNumeric.SetParameter(New RParameter("lowerlimit", 0))
Expand All @@ -235,8 +236,8 @@ Public Class sdgPICSARainfallGraph
ucrInputYSpecifyLowerLimitNumeric.AddQuotesIfUnrecognised = False

ucrChkYSpecifyUpperLimit.SetText("Specify Upper Limit")
ucrChkYSpecifyUpperLimit.AddParameterValuesCondition(True, "upperlimit", "NA", False)
ucrChkYSpecifyUpperLimit.AddParameterValuesCondition(False, "upperlimit", "NA", True)
ucrChkYSpecifyUpperLimit.SetParameter(New RParameter("upper_limit", iNewPosition:=1))
ucrChkYSpecifyUpperLimit.SetValuesCheckedAndUnchecked("TRUE", "FALSE")
ucrChkYSpecifyUpperLimit.AddToLinkedControls(ucrInputYSpecifyUpperLimitNumeric, {True}, bNewLinkedHideIfParameterMissing:=True)

ucrInputYSpecifyUpperLimitNumeric.SetParameter(New RParameter("upperlimit", 1))
Expand Down Expand Up @@ -424,7 +425,6 @@ Public Class sdgPICSARainfallGraph
ucrChkBorderLineType.AddToLinkedControls(ucrInputBorderLinetype, {True}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="Solid")
UcrChkBorderSize.AddToLinkedControls(ucrNudBorderSize, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True)


' Line tab
' Mean Line
ucrChkAddMean.SetText("Add Mean Line")
Expand Down Expand Up @@ -662,7 +662,8 @@ Public Class sdgPICSARainfallGraph
Optional clsNewLowerTercileFunction As RFunction = Nothing, Optional clsNewStatRegEquation As RFunction = Nothing, Optional clsNewStatsCorFunction As RFunction = Nothing,
Optional clsNewUpperTercileFunction As RFunction = Nothing, Optional clsNewAsDateMeanY As RFunction = Nothing, Optional clsNewAsDateMedianY As RFunction = Nothing,
Optional clsNewAsDateLowerTercileY As RFunction = Nothing, Optional clsNewAsDateUpperTercileY As RFunction = Nothing, Optional clsNewFormatMeanY As RFunction = Nothing,
Optional clsNewFormatMedianY As RFunction = Nothing, Optional clsNewFormatLowerTercileY As RFunction = Nothing, Optional clsNewFormatUpperTercileY As RFunction = Nothing, Optional bReset As Boolean = False)
Optional clsNewFormatMedianY As RFunction = Nothing, Optional clsNewFormatLowerTercileY As RFunction = Nothing,
Optional clsNewFormatUpperTercileY As RFunction = Nothing, Optional clsNewDummyFunction As RFunction = Nothing, Optional bReset As Boolean = False)
Dim clsCLimitsY As RFunction

bRCodeSet = False
Expand All @@ -675,6 +676,8 @@ Public Class sdgPICSARainfallGraph
'themes function
clsThemeFunction = clsNewThemeFunction

clsDummyFunction = clsNewDummyFunction

clsMutateFunction = clsNewMutateFunction
clsMeanFunction = clsNewMeanFunction
clsMedianFunction = clsNewMedianFunction
Expand Down Expand Up @@ -849,9 +852,9 @@ Public Class sdgPICSARainfallGraph
Else
clsCLimitsY = clsCLimitsYContinuous
End If
ucrChkYSpecifyLowerLimit.SetRCode(clsCLimitsY, bReset, bCloneIfNeeded:=True)
ucrChkYSpecifyLowerLimit.SetRCode(clsDummyFunction, bReset, bCloneIfNeeded:=True)
ucrInputYSpecifyLowerLimitNumeric.SetRCode(clsCLimitsYContinuous, bReset, bCloneIfNeeded:=True)
ucrChkYSpecifyUpperLimit.SetRCode(clsCLimitsY, bReset, bCloneIfNeeded:=True)
ucrChkYSpecifyUpperLimit.SetRCode(clsDummyFunction, bReset, bCloneIfNeeded:=True)
ucrInputYSpecifyUpperLimitNumeric.SetRCode(clsCLimitsYContinuous, bReset, bCloneIfNeeded:=True)

ucrChkSpecifyXAxisTickMarks.SetRCode(clsXScaleContinuousFunction, bReset, bCloneIfNeeded:=True)
Expand Down

0 comments on commit 0d80c15

Please sign in to comment.