我在 Pharo 上的 Graph-ET 中为我的基准测试绘制了条形图。有人知道如何将标签添加到 x 轴吗?我想在每个条形下写下基准的名称。
问问题
224 次
2 回答
3
打开工作区,然后键入以下内容:
| chart |
chart := GETDiagramBuilder new.
chart verticalBarDiagram
models: ($a to: $z);
y: #asInteger;
regularAxis;
height: 200.
chart open.
"We use the same model elements"
($a to: $z) do: [ :value |
| bar label |
"We define a label, and add it to the view"
label := ROLabel elementOn: value asString.
chart rawView add: label.
"We get the bar, the gray element that grows up"
bar := chart rawView elementFromModel: value.
"Move the label below its corresponding bar"
ROConstraint move: label below: bar ].
"Inserting high level labels"
chart rawView add: ((ROLabel red elementOn: 'Chart about my life') translateBy: 200 @ 0).
chart rawView add: ((ROLabel elementOn: 'Happiness') translateBy: -30 @ -40).
chart rawView add: ((ROLabel elementOn: 'Passing days') translateBy: 650 @ 210)
于 2013-09-17T15:07:09.437 回答
1
在 GraphET2(使用 Roassal2)中,构建您想要的图表更容易!
| chart |
chart := GET2Bar data: ($a to: $z).
chart
y: #asInteger;
title: 'Chart about my life';
titleColor: Color red.
chart yAxis title: 'Happiness'.
chart xAxis addModelLabels:[:v | |s| s:= v asString. s,s,s,s. ];
verticalLabelsInverted;
title: 'Passing days'.
chart open.
看看这里!
我希望它有帮助:)
于 2014-04-08T16:03:17.610 回答