Skip to content

Commit

Permalink
Merge pull request #31 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
Merge from Master Copy
  • Loading branch information
lilyclements authored Oct 6, 2016
2 parents 7ca6630 + 9ab59b8 commit ef56dcb
Show file tree
Hide file tree
Showing 6 changed files with 339 additions and 314 deletions.
46 changes: 32 additions & 14 deletions instat/dlgOneVariableGraph.vb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ Public Class dlgOneVariableGraph
Private bFirstLoad As Boolean = True
Private clsBaseOperatorOneColumn As New ROperator
Private clsBaseFunctionMultipleVariables As New RFunction
Public strNumericGeomFunction As String
Public strCategoricalGeomFunction As String

Private Sub dlgOneVariableGraph_Load(sender As Object, e As EventArgs) Handles Me.Load
autoTranslate(Me)
If bFirstLoad Then
InitialiseDialog()
SetDefaults()
InitialiseDialog()
bFirstLoad = False
Else
ReopenDialog()
Expand Down Expand Up @@ -67,13 +65,10 @@ Public Class dlgOneVariableGraph

clsBaseFunctionMultipleVariables.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$graph_one_variable")
sdgOneVarGraph.SetRSyntax(ucrBase.clsRsyntax)
sdgOneVarGraph.SetNumericGeomFunction(strNumericGeomFunction)
sdgOneVarGraph.SetCategoricalGeomFunction(strCategoricalGeomFunction)

End Sub

Private Sub ReopenDialog()

CheckDataType()
End Sub

Private Sub TestOkEnabled()
Expand All @@ -87,19 +82,19 @@ Public Class dlgOneVariableGraph
Private Sub OneOrMoreVariables()
If ucrReceiverOneVarGraph.GetVariablesAsList.Count = 1 Then
ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperatorOneColumn)

If ucrReceiverOneVarGraph.GetCurrentItemTypes()(0) = "numeric" Then
'TODO Geom should come from the subdialog
clsRgeom_Function.SetRCommand(strNumericGeomFunction)
sdgOneVarGraph.SetNumericGeomFunction()
clsRgeom_Function.SetRCommand(sdgOneVarGraph.strNumericGeomFunction)
If Not ucrReceiverOneVarGraph.IsEmpty() Then
clsRaesFunction.AddParameter("y", ucrReceiverOneVarGraph.GetVariableNames(False))
End If

clsRaesFunction.AddParameter("x", Chr(34) & Chr(34))
Else
'TODO Geom should come from the subdialog
clsRgeom_Function.SetRCommand(strCategoricalGeomFunction)

sdgOneVarGraph.SetCategoricalGeomFunction()
clsRgeom_Function.SetRCommand(sdgOneVarGraph.strCategoriacalGeomFunction)
If Not ucrReceiverOneVarGraph.IsEmpty() Then
clsRaesFunction.AddParameter("x", ucrReceiverOneVarGraph.GetVariableNames(False))
End If
Expand All @@ -117,6 +112,7 @@ Public Class dlgOneVariableGraph

Private Sub ucrReceiverOneVarGraph_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverOneVarGraph.SelectionChanged
OneOrMoreVariables()
CheckDataType()
TestOkEnabled()
End Sub

Expand All @@ -137,11 +133,33 @@ Public Class dlgOneVariableGraph
sdgOneVarGraph.ShowDialog()
End Sub

Private Sub rdoFacets_CheckedChanged(sender As Object, e As EventArgs) Handles rdoFacets.CheckedChanged
Private Sub rdoFacets_CheckedChanged(sender As Object, e As EventArgs) Handles rdoFacets.CheckedChanged, rdoCombineGraph.CheckedChanged, rdoSingleGraphs.CheckedChanged
SetOutputparameter()
End Sub

Private Sub SetOutputparameter()
If rdoFacets.Checked Then
clsBaseFunctionMultipleVariables.AddParameter("facets", "TRUE")
clsBaseFunctionMultipleVariables.AddParameter("output", Chr(34) & "facets" & Chr(34))
ElseIf rdoCombineGraph.Checked Then
clsBaseFunctionMultipleVariables.AddParameter("output", Chr(34) & "combine" & Chr(34))
ElseIf rdoSingleGraphs.Checked Then
clsBaseFunctionMultipleVariables.AddParameter("output", Chr(34) & "single" & Chr(34))
Else
clsBaseFunctionMultipleVariables.RemoveParameterByName("output") 'this might never run because atleast one must be checked at a time
End If
End Sub

Private Sub CheckDataType()
If ucrReceiverOneVarGraph.GetCurrentItemTypes(True).Count > 1 Then
rdoFacets.Enabled = False
rdoFacets.Checked = False
rdoCombineGraph.Checked = True
rdoCombineGraph.Enabled = True
Else
clsBaseFunctionMultipleVariables.RemoveParameterByName("facets")
rdoFacets.Enabled = True
rdoFacets.Checked = True
rdoCombineGraph.Checked = False
rdoCombineGraph.Enabled = False
End If
End Sub
End Class
Loading

0 comments on commit ef56dcb

Please sign in to comment.