Skip to content

Commit 956ba51

Browse files
committed
Added inspector views to DataFrame
1 parent f27cfe2 commit 956ba51

12 files changed

Lines changed: 89 additions & 54 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
as yet unclassified
2+
gtInspectorBoxplotIn: composite
3+
<gtInspectorPresentationOrder: 0>
4+
<gtInspectorTag: #basic>
5+
6+
composite roassal2
7+
title: 'Boxplots';
8+
initializeView: [ self boxplot ]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
as yet unclassified
2+
gtInspectorDataFrameIn: composite
3+
<gtInspectorPresentationOrder: 0>
4+
<gtInspectorTag: #basic>
5+
6+
composite morph
7+
title: 'DataFrame';
8+
display: [ self showWithGlamour ]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
gt-inspector-extension
2+
gtInspectorItemsIn: composite
3+
"Hiding Items tab from inspector"
4+
5+
^ (composite fastList)
6+
when: [ false ].
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
as yet unclassified
2+
gtInspectorPrettyPrintIn: composite
3+
<gtInspectorPresentationOrder: 1>
4+
<gtInspectorTag: #basic>
5+
6+
composite text
7+
title: 'PrettyPrint';
8+
display: [
9+
| stream |
10+
stream := String new writeStream.
11+
DataPrettyPrinter new print: self on: stream.
12+
stream contents ]
Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,4 @@
11
printing
22
printOn: aStream
33

4-
DataPrettyPrinter new print: self on: aStream.
5-
6-
"( self numberOfRows = 0 )
7-
ifTrue: [ super printOn: aStream.
8-
aStream nextPutAll:' uninitialized'. ^ self ].
9-
10-
aStream nextPutAll: '['.
11-
self columnNames
12-
do: [ :each | aStream nextPutAll: each asString ]
13-
separatedBy: [ aStream space ].
14-
aStream nextPutAll: ']'; cr.
15-
16-
1 to: self numberOfRows - 1 do: [ :i |
17-
(self rowNames at: i) printOn: aStream.
18-
aStream tab.
19-
20-
1 to: self numberOfColumns - 1 do: [ :j |
21-
(self at: i at: j) printOn: aStream.
22-
aStream space ]."
23-
24-
"Last one without a space"
25-
"(self at: i
26-
at: self numberOfColumns)
27-
printOn: aStream.
28-
29-
aStream cr ]."
30-
31-
"Last one without new line"
32-
"(self rowNames at: self numberOfRows) printOn: aStream.
33-
aStream tab.
34-
35-
1 to: self numberOfColumns - 1 do: [ :j |
36-
(self at: self numberOfRows at: j) printOn: aStream.
37-
aStream space ]."
38-
39-
"Last one without a space"
40-
"(self
41-
at: self numberOfRows
42-
at: self numberOfColumns)
43-
printOn: aStream.
44-
aStream space."
4+
DataPrettyPrinter new print: self on: aStream.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
as yet unclassified
1+
accessing
22
show
33

4-
self showWithGlamour
4+
self showWithGlamour openInWindowLabeled: 'a DataFrame'

DataFrame-Core.package/DataFrame.class/instance/showWithGlamour.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ showWithGlamour
44
| table |
55

66
table := FTTableMorph new
7-
extent: 650@500.
7+
"extent: 650@500".
88

99
table addColumn: ((FTColumn id: '#') width: 40).
1010

@@ -23,4 +23,4 @@ showWithGlamour
2323
beMultipleSelection;
2424
yourself.
2525

26-
^ table openInWindowLabeled: 'a DataFrame'.
26+
^ table

DataFrame-Core.package/DataSeries.class/instance/^equals.st

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
comparing
22
= otherSeries
33

4+
(otherSeries isKindOf: DataSeries)
5+
ifFalse: [ ^ false ].
6+
47
"I'm not sure if names should be considered when testing for equality"
58
self name = otherSeries name
69
ifFalse: [ ^ false ].
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
as yet unclassified
2+
histogram: barSize color: color
3+
4+
| aggregationKeys aggregatedSeries |
5+
6+
aggregationKeys := self keys asDataSeries % (self size / barSize).
7+
aggregatedSeries := (self groupBy: aggregationKeys) sum.
8+
9+
^ aggregatedSeries histogramWithColor: color
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
*DataFrame-Plots
2+
histogram
3+
4+
| n composer palette b |
5+
6+
n := self numericColumnNames size.
7+
composer := RTComposer new.
8+
9+
palette := DataColor palette: n.
10+
11+
(self numericColumnNames) doWithIndex: [ :columnName :i |
12+
b := (self column: columnName) histogramWithColor: (palette at: i).
13+
b extent: 500 @ (300 / n).
14+
b view: composer view.
15+
b build.
16+
composer group: 'b', i asString ].
17+
18+
2 to: n do: [ :i |
19+
composer
20+
move: ('b', i asString)
21+
below: ('b', (i - 1) asString) ].
22+
23+
^ composer view

0 commit comments

Comments
 (0)