Author(s): Isabel Martín García.
Version: 1.11#222 (2004/5/24, 13:8:7 CEST)
Version of last change: 1.11#154 (2004/1/7, 15:44:30 CET)
This module defines predicates which show barchart widgets. These bar charts are somewhat different from the bar charts generated by the predicates in modules genbar1, genbar2, genbar3 and genbar4. Predicates in the present module show different features of each dataset element in one chart at the same time. Each bar chart element is a group of bars, and the element features involve three vectors defined as follows:
Other relevant aspects about this widgets are:
"
as the value of the argument.
error2
will be thrown. If the vectors contains elements but are not correct, the exception error5
or error6
will be thrown, depending on what is incorrect. error5
means that XVector
and each element of YVector
do not contain the same number of elements or that YVector
and BarsAtt
do not contain the same number of elements, while error6
indicates that not all the BarsAtt
elements contain a correct number of attributes.
The examples will help you to understand how these predicates should be called.
genmultibar
)genmultibar
)
multibarchart(Header, BTitle, XTitle, XVector, YTitle, BarsAtts, YVector, Footer)
The x axis limits are autoarrange. The user can call the predicate in two ways. In the first example the user sets the appearance of the bars, in the second one the appearance features will be chosen by the library.
Example1:
multibarchart('This is the Header text', 'My BarchartTitle', 'Processors', ['processor1','processor2','processor3','processor4'], 'Time (seconds)', [['setup time','MediumTurquoise','Plum','pattern2'], ['sleep time','Blue','Green','pattern5'], ['running time','Yellow','Plum','pattern1']], [[20,30,40,50],[10,8,5,35],[60,100,20,50]], 'This is the Footer text').
Example2:
multibarchart('This is the Header text', 'My BarchartTitle', 'Processors', ['processor1','processor2','processor3','processor4'], 'Time (seconds)', [['setup time'],['sleep time'],['running time']], [[20,30,40,50],[10,8,5,35],[60,100,20,50]], 'This is the Footer text').
Usage:
Header
is a text (an atom) describing the header of the graph.
(genbar1:header/1
)
BTitle
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
XTitle
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
XVector
is a list of xelement
s.
(basic_props:list/2
)
YTitle
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
BarsAtts
is a list of multibar_attribute
s.
(basic_props:list/2
)
YVector
is a list of yelement
s.
(basic_props:list/2
)
Footer
is a text (an atom) describing the footer of the graph.
(genbar1:footer/1
)
multibarchart(Header, BT, XT, XVector, YT, BAtts, YVector, YMax, YMin, Footer)
This predicate is quite similar to
multibarchart/8
, except in that you can choose limits in the y axis. The part of the bars placed outside the limits will not be plotted.
Example2:
multibarchart('This is the Header text', 'My BarchartTitle', 'Processors', ['processor1','processor2','processor3','processor4'], 'Time (seconds)', [['setup time'],['sleep time'],['running time']], [[20,30,40,50],[10,8,5,35],[60,100,20,50]], [80], [0], 'This is the Footer text').
Usage:
Header
is a text (an atom) describing the header of the graph.
(genbar1:header/1
)
BT
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
XT
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
XVector
is a list of xelement
s.
(basic_props:list/2
)
YT
is a text (an atom) to be used as label, usually not very long.
(genbar1:title/1
)
BAtts
is a list of multibar_attribute
s.
(basic_props:list/2
)
YVector
is a list of yelement
s.
(basic_props:list/2
)
genbar1:axis_limit(YMax)
(genbar1:axis_limit/1
)
genbar1:axis_limit(YMin)
(genbar1:axis_limit/1
)
Footer
is a text (an atom) describing the footer of the graph.
(genbar1:footer/1
)
genmultibar
)multibar_attribute([LegendElement]) :- atomic(LegendElement). multibar_attribute([LegendElement,ForegroundColor,BackgroundColor,StipplePattern]) :- atom(LegendElement), color(ForegroundColor), color(BackgroundColor), pattern(StipplePattern).
Defines the attributes of each feature bar along the different datasets.
LegendElement
value of the list must be unique.
ForegroundColor
BackgroundColor
StipplePattern
xelement(Label) :- atomic(Label).
This type defines a dataset label. Although Label
values may be numbers, the will be treated as atoms, So it will be displayed at uniform intervals along the x axis.
Go to the first, previous, next, last section, table of contents.