OpenACS Diagram

This package extends the templating system of OpenACS by providing another builder next to the list and form builder. The diagram builder is very similar to the list builder. Two differences are important though: The multirow to be used must me defined bofore template::diagram::create is called since the column names are retrieved dynamically.

The diagram builder was developed in a way that it can be extended to use different engines for the rendering of the diagrams. Currently it is based on the "Javascript Diagram Builder", v3.3 Lutz Tautenhahn. But other engines could be integrated in future like GNUPlot.

Warning: This package is deprecated and has been replaced by [Sencha] JavaScript library.

Extending the Diagram Builder

The rendering is taking place in the templates defined under resources/diagram/..
. Currently we support the following types: pie, curve and cockpit. You can customize the way they render the diagrams by editing the corresponding templates or adding new ones. Once a template is created you simply pass its name with the -template switch of template::diagram::create.


You need to run the diagram-create.sql to view the examples below. It will create a table with dummy data. You can remove the table again using diagram-drop.sql.

A detailed example is given in the API Browser. This page also contains examples for the three diagram types "pie", "curve" and "cockpit". As you can see the diagrams are beautifully inserted inside the page flow. Also CSV-Export is possible.


Disc Usage









In order to make this builder easier to be extended the Javascript specific parts have to be removed:

  • Affected are the procs: template::diagram::prepare_value, template::diagram::update_borders and template::diagram::set_borders which nead a clean up. Maybe moving these information into the templates would be best.
  • Date and Timestamp based values from the database have to be formatted in a special way. You must use to_char(mydate, 'YYYY,MM,DD[,HH24][,MI][,SS]') in your sql query to return a meaningful value. As you can see some elements are optional. For details please view the Date and UTC objects documentation for JavaScript.

Future Work

Not everything available in the Javascript Diagram Builder was fully integrated. There are many other things that could be done in future as well. Here some ideas:

  • Give support for GNUPlot - a very powerful engine that has support for all diagram types including world maps...
  • Allow the definition of scales. Currently a developer would need to touch the Javascript Library to add new scales types
  • Add another package depeding on diagrams and portals and allows the definition of a repository of monitors and associate them with a role. Thus a given user could select from a extensible list of diagrams and define a user-specific report page. This would extend OpenACS towards real business intelligence toolkit for companies, universities and research labs. It would be important though to extend diagram to use from a pool of data sources like: databases, tcl scripts, remove web services...
  • Provide an XoTCL version in order to support different classes of diagrams and to improve reusablity.



Related Help

Related Tutorials

Related Object Types

Related Packages

Related Modules

Package Documentation 

Procedure Files

tcl/diagram-procs.tcl       Procs for the diagram builder. 


template::diagram::create       Defines a diagram to be displayed in a template. 
template::diagram::csv_quote       Quote a string for inclusion as a csv element 
template::diagram::element::create       Adds an element to a diagram builder diagram. 
template::diagram::element::get_reference       upvar the list element to the callers scope as $local_name 
template::diagram::element::render       Returns an ADP chunk, which must be evaluated 
template::diagram::prepare       Prepare list for rendering 
template::diagram::prepare_positioning       Sets the position of the diagram in accordance to the given coordinates 
template::diagram::prepare_value       prepares the values given the scale. 
template::diagram::set_borders       Sets the borders for the axis 
template::diagram::template       Process a list template with the special hacks into becoming a 'real' ADP template, as if it was included directly in the page. 
template::diagram::write_csv       Writes a CSV to the connection 
template::diagram::write_output       Writes the output to the connection if output isn't set to template. 

SQL Files


Content Pages


  Contact Us
  Project Open Business Solutions S.L.

Calle Aprestadora 19, 12o-2a

08902 Hospitalet de Llobregat (Barcelona)


 Tel Europe: +34 609 953 751
 Tel US: +1 415 200 2465