Go to the first, previous, next, last section, table of contents.


Depict barchart widgets - 3

Author(s): Isabel Martín García.

Version: 1.11#222 (2004/5/24, 13:8:7 CEST)

Version of last change: 1.11#146 (2004/1/1, 14:9:17 CET)

This module defines predicates which depict barchart widgets. The three predicates exported by this module plot two-variable data as regular bars in a window and are similar to those exported in the genbar1 module except in that these defined in this module do not display a legend. Thus, not all the argument types are equal.

The predicates test whether the format of the arguments is correct. If one or both vectors are empty, the exception error2 will be thrown. If the vectors contain elements but are not correct, the exception error1 or error3 will be thrown, depending on the error type. error1 means that XVector and YVector do not contain the same number of elements and error3 indicates that not all the XVector elements contain a correct number of attributes .

Usage and interface (genbar3)

Documentation on exports (genbar3)

PREDICATE: barchart3/7:

barchart3(Header, BarchartTitle, XTitle, XVector, YTitle, YVector, Footer)

As we mentioned in the above paragraph, this predicate is comparable to barchart1/8 except in the XVector argument type.

Example:

barchart3('This is the header text',
  'Barchart without legend',
  'My xaxistitle',
  [['bar1'],['bar2']],
  'My yaxixtitle',
  [20,10],
  'This is the footer text').

Usage:

PREDICATE: barchart3/9:

barchart3(Header, BTitle, XTitle, XVector, YTitle, YVector, YMax, YMin, Footer)

As we mentioned, this predicate is quite similar to the barchart1/10 except in the XVector argument type, because the yielded bar chart lacks of legend.

Example:

barchart3('This is the header text',
  'Barchart without legend',
  'My xaxistitle',
  [['bar1'],['bar2']],
  'My yaxixtitle',
  30,
  5,
  [20,10],
  'This is the footer text').

Usage:

PREDICATE: percentbarchart3/7:

percentbarchart3(Header, BTitle, XTitle, XVector, YTitle, YVector, Footer)

The y axis maximum coordinate value is 100. The x axis limits are autoarrange.

Example:

percentbarchart3('This is a special barchart to represent percentages',
          'Barchart without legend',
          'My xaxistitle',
          [ ['pr1','Blue','Yellow','pattern1'],
            ['pr2','MediumTurquoise','Plum','pattern5'] ],
          'My yaxixtitle',
          [80,10],
          'This is the footer text').

Usage:

Documentation on internals (genbar3)

REGTYPE: xbarelement3/1:
xbarelement3([XValue]) :-
        atomic(XValue).
xbarelement3([XValue,ForegColor,BackgColor,StipplePattern]) :-
        atomic(XValue),
        color(ForegColor),
        color(BackgColor),
        pattern(StipplePattern).

Defines the attributes of the bar.

XValue
bar label. Although XValue values may be numbers, the will be treated as labels. Different elements with the same label will produce different bars.
ForegColor
It sets the Foreground color of the bar. Its value must be a valid color, otherwise the system will throw an exception. If the argument value is a variable, it gets instantiated to a color chosen by the library.
BackgColor
It sets the Background color of the bar. Its value must be a valid color, otherwise the system will throw an exception. If the argument value is a variable, it gets instantiated to a color chosen by the library.
SPattern
It sets the stipple of the bar. Its value must be a valid pattern, otherwise the system will throw an exception. If the argument value is a variable, it gets instantiated to a pattern chosen by the library.


Go to the first, previous, next, last section, table of contents.