Skip to content

Commit

Permalink
Merge pull request #1972 from maxwellfundi/pop
Browse files Browse the repository at this point in the history
Additions on pyramid
  • Loading branch information
dannyparsons authored Oct 31, 2016
2 parents 4c4230c + dde715d commit 2d1b368
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 7 deletions.
16 changes: 14 additions & 2 deletions instat/dlgPopulationPyramids.Designer.vb

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

85 changes: 80 additions & 5 deletions instat/dlgPopulationPyramids.vb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
' You should have received a copy of the GNU General Public License k
' along with this program. If not, see <http://www.gnu.org/licenses/>.
Imports instat.Translations
Public Class dlgPopulationPyramids
Public Class dlgPopulationPyramids
Private clsRggplotFunction As New RFunction
Private clsRgeom_bar As New RFunction
Private clsRgeom_bar2 As New RFunction
Private clsRaesFunction As New RFunction
Private clsRgeom_CoordFlip As New RFunction
Private bFirstLoad As Boolean = True
Private Sub dlgPopulationPyramids_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If bFirstLoad Then
Expand All @@ -31,21 +36,91 @@ Public Class dlgPopulationPyramids

Private Sub InitialiseDialog()
ucrBase.iHelpTopicID = 455

ucrBase.clsRsyntax.SetOperation("+")
clsRggplotFunction.SetRCommand("ggplot")
clsRaesFunction.SetRCommand("aes")
clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRaesFunction)
ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRggplotFunction)
clsRgeom_bar.SetRCommand("geom_bar")
clsRgeom_bar.AddParameter("stat", Chr(34) & "identity" & Chr(34))
ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRgeom_bar)

clsRgeom_bar2.SetRCommand("geom_bar")
clsRgeom_bar2.AddParameter("stat", Chr(34) & "identity" & Chr(34))
ucrBase.clsRsyntax.AddOperatorParameter("geom_bar", clsRFunc:=clsRgeom_bar)

clsRgeom_CoordFlip.SetRCommand("coord_flip")
ucrBase.clsRsyntax.AddOperatorParameter("coord_flip", "coord_flip")

ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False

ucrXVariableReceiver.Selector = ucrPopulationPyramidselector
ucrYVariableReceiver.Selector = ucrPopulationPyramidselector
ucrSecondFactorReceiver.Selector = ucrPopulationPyramidselector

End Sub

Private Sub SetDefaults()

Private Sub SetDefaults()
ucrPopulationPyramidselector.Reset()
ucrXVariableReceiver.SetMeAsReceiver()
TestOkEnabled()
End Sub

Private Sub ReopenDialog()

End Sub
Private Sub TestOkEnabled()
If (ucrXVariableReceiver.IsEmpty AndAlso ucrYVariableReceiver.IsEmpty) Then
ucrBase.OKEnabled(False)
Else
ucrBase.OKEnabled(True)
End If

End Sub

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

Private Sub ucrPopulationPyramidselector_DataFrameChanged() Handles ucrPopulationPyramidselector.DataFrameChanged
clsRggplotFunction.AddParameter("data", clsRFunctionParameter:=ucrPopulationPyramidselector.ucrAvailableDataFrames.clsCurrDataFrame)
End Sub
Private Sub ucrXVariableReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrXVariableReceiver.SelectionChanged
If Not ucrXVariableReceiver.IsEmpty Then
clsRaesFunction.AddParameter("x", ucrXVariableReceiver.GetVariableNames(False))
Else
clsRaesFunction.RemoveParameterByName("x")
End If
TestOkEnabled()
End Sub

Private Sub ucrYVariableReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrYVariableReceiver.SelectionChanged
If Not ucrYVariableReceiver.IsEmpty Then
clsRaesFunction.AddParameter("y", ucrYVariableReceiver.GetVariableNames(False))
Else
clsRaesFunction.RemoveParameterByName("y")
End If
TestOkEnabled()
End Sub

Private Sub ucrSecondFactorReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrSecondFactorReceiver.SelectionChanged
If Not ucrSecondFactorReceiver.IsEmpty Then
clsRaesFunction.AddParameter("fill", ucrSecondFactorReceiver.GetVariableNames(False))
Else
clsRaesFunction.RemoveParameterByName("fill")
End If
End Sub

Private Sub ucrSavePopulationPyramid_ContentsChanged() Handles ucrSavePopulationPyramid.ContentsChanged
TestOkEnabled()
End Sub

Private Sub ucrSavePopulationPyramid_GraphNameChanged() Handles ucrSavePopulationPyramid.GraphNameChanged, ucrSavePopulationPyramid.SaveGraphCheckedChanged
If ucrSavePopulationPyramid.bSaveGraph Then
ucrBase.clsRsyntax.SetAssignTo(ucrSavePopulationPyramid.strGraphName, strTempDataframe:=ucrPopulationPyramidselector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrSavePopulationPyramid.strGraphName)
Else
ucrBase.clsRsyntax.SetAssignTo("last_graph", strTempDataframe:=ucrPopulationPyramidselector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph")
End If
TestOkEnabled()
End Sub
End Class

0 comments on commit 2d1b368

Please sign in to comment.