Skip to content

Instantly share code, notes, and snippets.

@SergeStinckwich
Created January 10, 2017 10:52
Embed
What would you like to do?
CSV fingerprint with Roassal
|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