Skip to content

Commit

Permalink
Merge pull request #103 from africanmathsinitiative/master
Browse files Browse the repository at this point in the history
updating master
  • Loading branch information
Vitalis95 authored Oct 31, 2022
2 parents b76cc41 + 0d44393 commit 00fa746
Show file tree
Hide file tree
Showing 22 changed files with 299 additions and 130 deletions.
13 changes: 13 additions & 0 deletions instat/Model/DataFrame/clsDataBook.vb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Imports RDotNet
Public Class clsDataBook
Private _RLink As RLink
Private _lstDataFrames As List(Of clsDataFrame)
Private _lstAllDataFrames As New List(Of clsDataFrame)
Private _clsDataFrameMetaData As clsDataFrameMetaData

''' <summary>
Expand Down Expand Up @@ -95,6 +96,10 @@ Public Class clsDataBook
Return _lstDataFrames.Where(Function(x) x.strName = strName).FirstOrDefault
End Function

Public Function GetAllDataFrame(strName As String) As clsDataFrame
Return _lstAllDataFrames.Where(Function(x) x.strName = strName).FirstOrDefault
End Function

''' <summary>
''' Gets the Column Metadata for the dataframe name given
''' </summary>
Expand All @@ -112,6 +117,7 @@ Public Class clsDataBook
'and refresh the data frame metadata from R
If Not _RLink.bInstatObjectExists Then
_lstDataFrames.Clear()
_lstAllDataFrames.Clear()
_clsDataFrameMetaData = New clsDataFrameMetaData(_RLink)
Exit Sub
End If
Expand All @@ -131,6 +137,13 @@ Public Class clsDataBook
'get the recent list of data frame names from R Instant
Dim lstOfCurrentRDataFrameNames As List(Of String) = GetDataFrameNamesFromR()

'add any data frames from this data book before removing them if not the R Instat object
For Each clsDataframe In _lstDataFrames
If Not _lstAllDataFrames.Contains(clsDataframe) Then
_lstAllDataFrames.Add(clsDataframe)
End If
Next

'remove any data frames from this data book that are not in the R Instat object
_lstDataFrames.RemoveAll(Function(x) Not lstOfCurrentRDataFrameNames.Contains(x.strName))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ Public Class ucrDataframeMetadataReoGrid
For i = 0 To _clsDataBook.clsDataFrameMetaData.RowCount - 1
For j = 0 To grdData.CurrentWorksheet.Columns - 1
grdData.CurrentWorksheet(row:=i, col:=j) = _clsDataBook.clsDataFrameMetaData.Data(i, j)
Dim clsDataFrame As clsDataFrame = _clsDataBook.GetAllDataFrame(_clsDataBook.clsDataFrameMetaData.Data(i, 0))
If clsDataFrame IsNot Nothing Then
Dim strColumnHeaderText As String = grdData.CurrentWorksheet.ColumnHeaders(j).Text
grdData.CurrentWorksheet(row:=i, col:=j) = _clsDataBook.clsDataFrameMetaData.Data(i, j)
If clsDataFrame.clsFilterOrColumnSelection.bFilterApplied AndAlso strColumnHeaderText = "Rows" _
OrElse (clsDataFrame.clsFilterOrColumnSelection.bColumnSelectionApplied AndAlso strColumnHeaderText = "Columns") Then
grdData.CurrentWorksheet.Cells(row:=i, col:=j).Style.TextColor = Color.Red
End If
End If
Next
grdData.CurrentWorksheet.RowHeaders.Item(i).Text = _clsDataBook.clsDataFrameMetaData.RowName(i)
Next
Expand Down
60 changes: 30 additions & 30 deletions instat/dlgOptions.Designer.vb

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

85 changes: 54 additions & 31 deletions instat/dlgOptionsByContextBoxplot.Designer.vb

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

6 changes: 6 additions & 0 deletions instat/dlgOptionsByContextBoxplot.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
<metadata name="contextMenuStripOptions.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
Loading

0 comments on commit 00fa746

Please sign in to comment.