Skip to content

Commit

Permalink
Merge pull request #196 from IDEMSInternational/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
MeSophie authored Feb 26, 2024
2 parents 61fea94 + 971cc66 commit 6dda992
Show file tree
Hide file tree
Showing 86 changed files with 9,659 additions and 4,322 deletions.
264 changes: 132 additions & 132 deletions instat/DlgDefineClimaticData.Designer.vb

Large diffs are not rendered by default.

71 changes: 70 additions & 1 deletion instat/UcrGeomListWithAes.vb
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ Public Class ucrGeomListWithParameters
SetReceiverColour()
End Sub

Private Sub AddRFunctionParameter(parentFunction As RFunction, paramName As String, paramValue As String)
Dim clsProductFunction As New RFunction
clsProductFunction.SetPackageName("ggmosaic")
clsProductFunction.SetRCommand("product")
clsProductFunction.AddParameter(paramName, paramValue, bIncludeArgumentName:=False)
parentFunction.AddParameter(paramName, clsRFunctionParameter:=clsProductFunction)
End Sub

Public Sub UpdateGlobalAndLocalAesFromInter()
Dim clsRelevantAesFunction As New RFunction 'Will be used in the partially mandatory aes filling method below.
Dim clsCurrentAesFunction As RFunction
Expand Down Expand Up @@ -342,9 +350,67 @@ Public Class ucrGeomListWithParameters
clsCurrentAesFunction = clsLocalAesFunction
End If

If clsGeomFunction.strRCommand = "geom_mosaic" Then
Dim xParameterIndex As Integer = clsLocalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "x")
Dim condsParameterIndex As Integer = clsLocalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "conds")

If xParameterIndex >= 0 Then
Dim strArgNameValue = clsLocalAesFunction.clsParameters(xParameterIndex).strArgumentValue
AddRFunctionParameter(clsCurrentAesFunction, "x", strArgNameValue)
End If

If condsParameterIndex >= 0 Then
Dim strArgNameValue = clsLocalAesFunction.clsParameters(condsParameterIndex).strArgumentValue
AddRFunctionParameter(clsCurrentAesFunction, "conds", strArgNameValue)
End If

Dim xParameterGlobalIndex As Integer = clsGlobalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "x")
Dim condsParameterGlobalIndex As Integer = clsGlobalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "conds")

If xParameterGlobalIndex >= 0 Then
Dim strArgNameValue = clsGlobalAesFunction.clsParameters(xParameterGlobalIndex).strArgumentValue
AddRFunctionParameter(clsCurrentAesFunction, "x", strArgNameValue)
End If

If condsParameterGlobalIndex >= 0 Then
Dim strArgNameValue = clsGlobalAesFunction.clsParameters(condsParameterGlobalIndex).strArgumentValue
AddRFunctionParameter(clsCurrentAesFunction, "conds", strArgNameValue)
End If
End If

If clsGeomFunction.strRCommand = "geom_mosaic_jitter" Then
Dim xParameterIndex As Integer = clsLocalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "x")
Dim condsParameterIndex As Integer = clsLocalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "conds")

If xParameterIndex >= 0 Then
Dim strArgNameValue = clsLocalAesFunction.clsParameters(xParameterIndex).strArgumentValue
AddRFunctionParameter(clsCurrentAesFunction, "x", strArgNameValue)
End If

If condsParameterIndex >= 0 Then
Dim strArgNameValue = clsLocalAesFunction.clsParameters(condsParameterIndex).strArgumentValue
AddRFunctionParameter(clsCurrentAesFunction, "conds", strArgNameValue)
End If
End If

If clsGeomFunction.strRCommand = "geom_mosaic_text" Then
Dim xParameterIndex As Integer = clsLocalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "x")
Dim condsParameterIndex As Integer = clsLocalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "conds")

If xParameterIndex >= 0 Then
Dim strArgNameValue = clsLocalAesFunction.clsParameters(xParameterIndex).strArgumentValue
AddRFunctionParameter(clsCurrentAesFunction, "x", strArgNameValue)
End If

If condsParameterIndex >= 0 Then
Dim strArgNameValue = clsLocalAesFunction.clsParameters(condsParameterIndex).strArgumentValue
AddRFunctionParameter(clsCurrentAesFunction, "conds", strArgNameValue)
End If
End If

'This is a temporary solution to issue which should be solved with geoms
'This adds "" aes for x or y when no variables are mapped to them for geoms which require it, either adding to the global or local aes.
If clsGeomFunction.strRCommand = "geom_boxplot" OrElse clsGeomFunction.strRCommand = "geom_dotplot" Then
If clsGeomFunction.strRCommand = "geom_boxplot" OrElse clsGeomFunction.strRCommand = "geom_dotplot" OrElse clsGeomFunction.strRCommand = "geom_violin" Then
If (clsGlobalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "x") = -1 OrElse ucrChkIgnoreGlobalAes.Checked) AndAlso clsLocalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "x") = -1 Then
clsCurrentAesFunction.AddParameter("x", Chr(34) & Chr(34))
End If
Expand All @@ -358,6 +424,9 @@ Public Class ucrGeomListWithParameters
End If
'Adding stat = identity method
If {"geom_bar", "geom_density", "geom_freqpoly"}.Contains(clsGeomFunction.strRCommand) Then
If (clsGlobalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "x") = -1 OrElse ucrChkIgnoreGlobalAes.Checked) AndAlso clsLocalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "x") = -1 Then
clsCurrentAesFunction.AddParameter("x", Chr(34) & Chr(34))
End If
'If there is a y in the global aes, and the global aes are not ignored or if there is a y in the local aes then in case stat has not been set manually, stat is set to identity.
If (((clsGlobalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "y") <> -1) AndAlso ((clsGeomFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "inherit.aes") = -1) OrElse (Not ucrChkIgnoreGlobalAes.Checked))) OrElse (clsLocalAesFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "y") <> -1)) AndAlso (clsGeomFunction.clsParameters.FindIndex(Function(x) x.strArgumentName = "stat") = -1) Then
clsGeomFunction.AddParameter("stat", Chr(34) & "identity" & Chr(34))
Expand Down
104 changes: 87 additions & 17 deletions instat/dlgBarAndPieChart.Designer.vb

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

Loading

0 comments on commit 6dda992

Please sign in to comment.