Hello Alexandre,
I am trying to revive this thread.
Sorry for not posting any updates in such a long time.
Unfortunately, I just did not have time to experiment with this any further.
My latest attempt was to replace the straight lines with BezierLine
elements.
The code and a screenshot can be found here:
https://gist.github.com/mkroehnert/aa3d1d9913cb0f29a49f
It looks okay, but in my opinion, the code for creating the BezierLine is a
bit cumbersome.
Especially having to create invisible RTEllipse elements for control points.
Therefore, it would be nice to have your opinion on this.
Is this correct, or are there better ways to achieve this?
Thanks a lot,
Manfred
On Fri, Jun 5, 2015 at 10:50 PM, Alexandre Bergel <alexandre.bergel(a)me.com>
wrote:
Yeah!!!
Looks good! Keep doing!
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Jun 5, 2015, at 12:42 PM, Manfred Kröhnert <mkroehnert42(a)googlemail.com>
wrote:
Thanks Alexandre,
great advice once again.
Here is the current result
<ParallelCoordinates.png>
and the script:
========
"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.
Thanks,
Manfred