CSV fingerprint with Roassal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|tab b shape elements v lb| | |
tab := RTTabTable new input: (ZnEasy get: | |
'https://raw.githubusercontent.com/setosa/csv-fingerprint/master/example2.csv') | |
entity contents asString usingDelimiter:$,. | |
v := RTView new. | |
elements := #(). | |
tab values do:[:row|elements := elements, row.]. | |
shape := RTBox new height:1; width:20; color: [:e | e isEmpty ifTrue: | |
[Color black] ifFalse:[ | |
[(e asNumber) isInteger ifTrue: [ Color blue ] ifFalse:[(e asNumber) | |
isFloat ifTrue: [ Color purple ]]] | |
on: Error do: [:ex| Color yellow]]]. | |
es := shape elementsOn: elements. | |
v addAll: es. | |
RTGridLayout new | |
gapSize: 0; | |
lineItemsCount: (tab values at:1) size; | |
on: v elements. | |
lb := RTLegendBuilder new. | |
lb view: v view. | |
lb addColor: Color yellow text: 'String'. | |
lb addColor: Color black text: 'Missing value'. | |
lb addColor: Color purple text: 'Decimal'. | |
lb addColor: Color blue text: 'Integer'. | |
lb build. | |
v. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment