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


Barchart widgets - 2

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

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

Version of last change: 1.9#158 (2003/12/4, 17:39:21 CET)

This module defines predicates which show barchart widgets. The three predicates exported by this module plot two-variable data as regular bars in a window. They all share the following features:

Particular features will be pointed out in the corresponding predicate.

Usage and interface (genbar2)

Documentation on exports (genbar2)

PREDICATE: barchart2/7:

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

The maximum and minimum limits for axes are determined from the data.

Example:

barchart2('This is the header text',
  'Barchart with legend',
  'My xaxistitle',
  [ [1,'bar1','Blue','Yellow','pattern1'],
       [2,'bar2','MediumTurquoise','Plum','pattern5'] ],
  'My yaxixtitle',
  [20,10],
  'This is the footer text').

Usage:

PREDICATE: barchart2/11:

barchart2(Header, BT, XT, XVector, XMax, XMin, YT, YVector, YMax, YMin, Footer)

You can set the minimum and maximum limits of the axes. Data outside the limits will not be plotted. Each limit, as you can check looking at the axis_limit/1 definition, is a number. If the argument is a variable the limit will be calculated from the data (i.e., if YMax value is YValueMax the maximum y axis limit will calculated using the largest data value). Example:

barchart2('This is the header text',
  'Barchart with legend',
  'My xaxistitle',
  [ [1,'bar1',Color1,Color2,Pattern1],
         [2,'bar2',Color3,Color4,Pattern2] ],
  10,
  -10,
  'My yaxixtitle',
  [20,10],
  100,
  -10,
  'The limits for the axes are set by the user').

Usage:

PREDICATE: percentbarchart2/7:

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

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

Example:

percentbarchart2('This is a special barchart to represent percentages',
  'Barchart with legend',
  'My xaxistitle',
  [ [1,'bar1','Blue','Yellow','pattern1'],
          [2,'bar2','MediumTurquoise','Plum','pattern5'] ],
  'My yaxixtitle',
  [80,10],
  'This is the footer text').

Usage:

REGTYPE: xbarelement2/1:
xbarelement2([XValue,LegendElement]) :-
        number(XValue),
        atomic(LegendElement).
xbarelement2([XValue,LegendElement,ForegColor,BackgColor,SPattern]) :-
        number(XValue),
        atomic(LegendElement),
        color(ForegColor),
        color(BackgColor),
        pattern(SPattern).

Defines the attributes of the bar.

XValue
x-coordinate position of the bar. Different elements with the same abscissas will produce overlapped bars.
LegendElement
Element legend name. It may be a number or an atom and equal or different to the XValue. Every LegendElement value of the list must be unique.
ForegColor
Is 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
Is 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
Is 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.