本文介绍了如何在 Prolog GUI (XPCE) 编程中制作条形图(条形图)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过在 Proglog 库中使用 XPCE 来制作条形图.虽然我找到了一些材料,但我不能马上执行.代码如下.

I'm trying to make a barchart by using XPCE in Proglog libraries. Though I found some materials but I cannot execute it right away.The code is as below.

barchart :-
    barchart(vertical).
barchart(HV) :-
    new(W, picture),
    active_classes(Classes),
    length(Classes, N),
    required_scale(Classes, Scale),
    send(W, display, new(BC, bar_chart(HV, 0, Scale, 200, N))),
    forall(member(class(Name, Created, Freed), Classes),
           send(BC, append,
                bar_group(Name,
                          bar(created, Created, green),
                          bar(freed, Freed, red)))),
    send(W, open).

我想做的就是这个网站的图27.

And what I want to make is like Figure27 in this site.

http://www.swi-prolog.org/packages/xpce/UserGuide/libplot.html

已编辑)

我只想制作非常简单的条形图.像下面这样.http://image.tutorvista.com/content/feed/u845/bargraph.gif

I just want to make very simple bar chart. Like this below.http://image.tutorvista.com/content/feed/u845/bargraph.gif

抱歉链接不是图片(我没有足够的声望点来上传图片)

sorry for link not image(I don't have enough reputation points to upload the picture)

推荐答案

这里(另一个)示例

:- use_module(library(pce)).
:- use_module(library(plot/barchart)).
:- use_module(library(autowin)).

test_barchart :-
    new(W, picture),
    send(W, display, new(BC, bar_chart(vertical,0,200))),
    forall(member(Name/Height/Color,
              [x/100/red, y/150/green, z/80/blue, v/50/yellow]),
           (   new(B, bar(Name, Height)),
               send(B, colour(Color)),
               send(BC, append, B)
           )),
    send(W, open).

产生

您可以从 Help\XPCE Manual\Browsers\Class Browser... 中检查 XPCE 对象...

You can inspect XPCE objects from Help\XPCE Manual\Browsers\Class Browser...

这篇关于如何在 Prolog GUI (XPCE) 编程中制作条形图(条形图)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 00:02