Skip to content

Instantly share code, notes, and snippets.

@SergeStinckwich
Created January 10, 2017 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SergeStinckwich/f50edd3ea86a77510d3f7a08f9b08716 to your computer and use it in GitHub Desktop.
Save SergeStinckwich/f50edd3ea86a77510d3f7a08f9b08716 to your computer and use it in GitHub Desktop.
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