gpt4 book ai didi

smalltalk - Graph-ET x 轴标签

转载 作者:行者123 更新时间:2023-12-04 02:45:54 25 4
gpt4 key购买 nike

我在 Pharo 上的 Graph-ET 中为我的基准绘制了一个条形图。有没有人知道如何将标签添加到 x 轴吗?我想在每个条形图下写下基准的名称。

最佳答案

打开一个工作区,然后键入以下内容:

| 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)

This is what you get with the code above

关于smalltalk - Graph-ET x 轴标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18831437/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com