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).
And what I want to make is like Figure27 in this site.
http://www.swi-prolog.org/packages/xpce/UserGuide/libplot.html
Edited)
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)
here (another) sample
:- 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).
that yields
You can inspect XPCE objects from Help\XPCE Manual\Browsers\Class Browser...