contents index next

10. hdrug_chart: Displaying Charts

The module hdrug_chart is intended to be used to display chart-like data-structures (on a Tcl/Tk canvas).

10.1. Global Variables

This section lists the global variables maintained by the hdrug_chart library.

10.1.1. user:chart_xdist

This flag determines the horizontal distance between nodes of the chart.

10.1.2. user:chart_ydist

This flag determines the distance between edges over the same range.

10.2. Hook Predicates

This section lists the hook predicates for the hdrug_chart library.

10.2.1. user:pp_chart_show_node_help(Atom)

Short atom to be displayed in the help-line upon entering nodes of the chart. This is typically used to indicate the corresponding actions of mouse clicks on the nodes.

10.2.2. user:pp_chart_item[23](Ident)

Used by hdrug_chart. This predicate can be used to define an action to be executed upon clicking the label of an edge of the chart. This variant is for edges above the horizontal axis. The argument Ident refers to the fourth argument of the relevant edge that was one of the elements in the list passed on as the second argument of the pp_chart/3 predicate. The variants with a 2 or 3 suffix are used to define an action for the second or third mouse button.

10.2.3. user:pp_chart_item_b[23](Ident)

Used by hdrug_chart. This predicate can be used to define an action to be executed upon clicking the label of an edge of the chart. This variant is for edges below the horizontal axis. The argument Ident refers to the fourth argument of the relevant edge that was one of the elements in the list passed on as the third argument of the pp_chart/3 predicate. The variants with a 2 or 3 suffix are used to define an action for the second or third mouse button.

10.3. Predicates

This section lists the predicates exported by the hdrug_chart library.

10.3.1. pp_chart(Nodes,Edges,Bedges)

Pretty-printing routine (on the Tk widget) for chart-like datastructures. Nodes is a list of integers, indicating the nodes of the chart (the string positions). Edges is a list of edges. Each edge is a term edge(P,Q,Cat,Ident) where P and Q are chart nodes, Cat is some atom used as the label of the edge, and Ident is some atom used to identify the edge. This identifier is passed on to the hook predicates pp_chart_item and pp_chart_item_b which can be used to define an action for clicking the label of a chart item. Bedges is also a list of edges; these edges are placed on and below the nodes of the chart (this can be used, for instance, to display the words of the chart). Example:

?- pp_chart([0,1,2],[edge(0,1,np,1),edge(1,2,vp,2),edge(0,2,s,3)],
                    [edge(0,1,jan,4), edge(1,2,slaapt,5)]).

contents index next