great advice once again.
"configuration"
spaceBetweenLine := 150.
lineHeight := 250.
labelColor := (Color red alpha: 0.3).
lineColor := (Color red alpha: 0.2).
"columns: Array of column label Arrays"
columns := #(
#('One' 'Two')
#('Ten' 'Eleven' 'Twelve' 'Thirteen' 'Fourteen' 'Fifteen')
#('Twenty' 'Twentyone' 'Twentytwo' 'Twentythree')
).
"values: Array of columns
column: Array of columnelements
columnelement: Array of indices the element is associated with in the next column"
values := #(
#( #(1 3 4 5 6) #(2 3 5) )
#( #(1 2) #(1 2 3) #(3 4) #(2 3 4) #(2 4) #(4) )
).
numberOfColumns := columns size.
maxColumnElements := (columns
collect: [ :element | element size])
reduce: [ :size1 :size2 | size1 max: size2 ].
v := RTView new.
label := RTLabel text: [ :t | t ].
label color: labelColor.
"draw labels"
columnElements := OrderedCollection new.
1 to: numberOfColumns do: [ :i | | t labels |
t := OrderedCollection new.
labels := label elementsOn: (columns at: i).
labels doWithIndex: [ :element :index |
t add: element.
element translateTo:
(i * (spaceBetweenLine - 1)) @
(index * lineHeight / maxColumnElements).
v add: element
].
columnElements add: t.
].
v.
"draw lines"
2 to: numberOfColumns do: [ :column |
(values at: column - 1) doWithIndex: [ :setOfValues :index |
setOfValues do: [ :setIndex |
| fromElement toElement line |
fromElement := ((columnElements at: (column - 1)) at: index).
toElement := ((columnElements at: column) at: setIndex).
lineShape := RTLine new color: lineColor.
lineShape attachPoint: RTShorterDistanceAttachPoint new.
line := lineShape
edgeFrom: fromElement
to: toElement.
v add: line
].
].
].
v
The last thing I am going to experiment with will be to replace the straight lines with RTBezierLine.