Skip to content

Commit

Permalink
Merge pull request #5 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
fetching the latest copy of master
  • Loading branch information
bethanclarke committed Feb 18, 2016
2 parents d323028 + c5a377d commit 2df52dd
Show file tree
Hide file tree
Showing 34 changed files with 1,446 additions and 448 deletions.
23 changes: 0 additions & 23 deletions instat/clsRLink.vb
Original file line number Diff line number Diff line change
Expand Up @@ -233,29 +233,6 @@ Public Class RLink
bInstatObjectExists = True
End Sub

Public Sub LoadData(strDataName As String, strFile As String, strFileExt As String)
Dim clsRSyntax As New RSyntax
Select Case strFileExt
Case ".RDS"
If Not bInstatObjectExists Then
clsRSyntax.SetAssignTo(frmMain.clsRLink.strInstatDataObject)
clsRSyntax.SetFunction("readRDS")
clsRSyntax.AddParameter("file", Chr(34) & strFile & Chr(34))
RunScript(clsRSyntax.GetScript())
frmMain.clsRLink.bInstatObjectExists = True
End If
Case ".csv"
If Not bInstatObjectExists Then
CreateNewInstatObject()
End If
clsRSyntax.SetFunction("read.csv")
clsRSyntax.AddParameter("file", Chr(34) & strFile & Chr(34))
clsRSyntax.SetAssignTo(strDataName, strTempDataframe:=strDataName)
RunScript(clsRSyntax.GetScript())
End Select
frmMain.clsGrids.UpdateGrids()
End Sub

Public Sub FillListView(lstView As ListView, Optional strDataType As String = "all", Optional strDataFrameName As String = "")
Dim dfList As GenericVector
Dim dfTemp As DataFrame
Expand Down
144 changes: 79 additions & 65 deletions instat/dlgBarAndPieChart.Designer.vb

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

54 changes: 52 additions & 2 deletions instat/dlgBarAndPieChart.vb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@
' 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 dlgBarAndPieChart
Private clsRggplotFunction As New RFunction
Private clsRgeom_barchart As New RFunction
Private clsRgeom_piechart As New RFunction
Private clsRgeom_piechartCoord As New RFunction
Private clsRaesFunction As New RFunction
Private Sub dlgBarAndPieChart_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ucrBase.clsRsyntax.SetOperation("+")
clsRggplotFunction.SetRCommand("ggplot")
clsRaesFunction.SetRCommand("aes")
clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRaesFunction)
ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRggplotFunction)
ucrFactorReceiver.Selector = ucrBarChartSelector
ucrSecondReceiver.Selector = ucrBarChartSelector
ucrFactorReceiver.SetMeAsReceiver()
Expand All @@ -29,7 +38,48 @@ Public Class dlgBarAndPieChart
sdgPlots.ShowDialog()
End Sub

Private Sub rdoBarChart_CheckedChanged(sender As Object, e As EventArgs) Handles rdoBarChart.CheckedChanged
Private Sub ucrBarChartSelector_DataFrameChanged(sender As Object, e As EventArgs) Handles ucrBarChartSelector.DataFrameChanged
clsRggplotFunction.AddParameter("data", clsRFunctionParameter:=ucrBarChartSelector.ucrAvailableDataFrames.clsCurrDataFrame)
End Sub
Private Sub ucrFactorReceiver_Leave(sender As Object, e As EventArgs) Handles ucrFactorReceiver.Leave
If rdoBarChart.Checked = True Then
clsRaesFunction.AddParameter("x", ucrFactorReceiver.GetVariableNames(False))
Else
clsRaesFunction.AddParameter("fill", ucrFactorReceiver.GetVariableNames(False))

End If
End Sub
Private Sub ucrSecondReceiver_Leave(sender As Object, e As EventArgs) Handles ucrSecondReceiver.Leave
If rdoBarChart.Checked = True Then
clsRaesFunction.AddParameter("fill", ucrSecondReceiver.GetVariableNames(False))
Else
clsRaesFunction.AddParameter("x", Chr(34) & Chr(34))
End If
End Sub

Private Sub grpSelection_CheckedChanged(sender As Object, e As EventArgs) Handles rdoBarChart.CheckedChanged, rdoPieChart.CheckedChanged
If rdoBarChart.Checked = True Then
clsRgeom_barchart.SetRCommand("geom_bar")
ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRgeom_barchart)

ElseIf rdoPieChart.Checked = True Then

Dim clsTempOp As New ROperator
Dim clsTempRFunc As New RFunction
clsTempOp.SetOperation("+")

clsRgeom_piechart.SetRCommand("geom_bar")
ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRgeom_piechart)
clsRgeom_piechart.AddParameter("width", "1")

clsTempOp.SetParameter(True, clsRFunc:=clsRggplotFunction)
clsTempOp.SetParameter(False, clsRFunc:=clsRgeom_piechart)
clsTempRFunc.SetRCommand("coord_polar")
clsTempRFunc.AddParameter("theta", Chr(34) & "y" & Chr(34))
ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsTempOp)
ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsTempRFunc)
Else
ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=Nothing)
End If
End Sub
End Class
2 changes: 1 addition & 1 deletion instat/dlgBoxplotMethod.vb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Imports instat.Translations
Public Class dlgBoxplotMethod
Private Sub ucrBase_Load(sender As Object, e As EventArgs) Handles ucrBase.Load
autoTranslate(Me)
ucrBase.clsRsyntax.SetFunction("climate_obj$boxplot")
ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strClimateObject & "$boxplot_method")
ucrBase.clsRsyntax.iCallType = 0
End Sub

Expand Down
Loading

0 comments on commit 2df52dd

Please sign in to comment.