How to get vertical labels with Roassal?

179 views Asked by At

I could not find a way to get vertical labels in a Roassal visualization. Is there a way? Or a general way to rotate elements?

Vertical Labels

2

There are 2 answers

1
Pablo Estefó On BEST ANSWER

The new version, Roassal2, does supports rotated labels. In the case of the example above, now you can do:

| view |
view := RTView new.
-15 to: 10 do: [ :i |
    view add: ((RTRotatedLabel new angleInDegree: -90) elementOn: 'hello world').
].
RTHorizontalLineLayout on: view elements.
view open

You will get:

enter image description here

Another example:

| v shape |
v := RTView new.
shape := RTRotatedLabel new.
shape angleInDegree: [ :cls | cls numberOfMethods negated / 1.5 ].
shape text: [ :cls | ' ', cls name ].
shape color: (Color black alpha: 0.2).
v addAll: (shape elementsOn: Collection withAllSubclasses).

v canvas color: Color white.
v open

You will have:

enter image description here

I hope it helps :-)

0
Alexandre Bergel On

Currently, Roassal does not support such a feature. However you can get something close to.

| view |
view := ROView new.
-15 to: 10 do: [ :i |
    view add: ((ROLabel verticalText interlineSpace: i) elementOn: 'hello world').
].
ROHorizontalLineLayout on: view elements.
view open

In Roassal 1.422