[英]How to get vertical labels with Roassal?
I could not find a way to get vertical labels in a Roassal visualization. 我找不到在Roassal可视化中获取垂直标签的方法。 Is there a way? 有办法吗? Or a general way to rotate elements? 还是旋转元素的一般方法?
Currently, Roassal does not support such a feature. 目前,Roassal不支持该功能。 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 在Roassal 1.422中
The new version, Roassal2, does supports rotated labels. 新版本Roassal2确实支持旋转标签。 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: 你会得到:
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: 您将拥有:
I hope it helps :-) 希望对您有所帮助:-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.