Forum OpenACS Q&A: ANN: New diagram package added to cvs

Hi all,

I added the new diagram package to cvs under openacs-4/packages. I hope the location is correct. The API is stable as it is in the style of list builder.

I added some documentation with sample data. If you are using the package on a production server simply skip the diagram-create.sql file. Documentation is found under /doc/diagram/.

You need to restart the server to load the API. The relevant procs are documented as well under

/api-doc/proc-view?proc=template::diagram::create
/api-doc/proc-view?proc=template::diagram::element::create

This package is basically a wrapper around the JS diagram library of Lutz Tautenhahn as found under http://www.lutanho.net/diagram/. I added a diagram type I called cockpit (see documentation).

The package was tested on Firefox, Opera, Internet Explorer. It was reported to be working on Safari.

Greetings,
Nima

Collapse
Posted by Nima Mazloumi on
If someone is willing to port the package to XoTCL or give support for server-side libraries like GNUPlot - she/he is more than welcome :)

I also found some modules which the naviserver provides:
nschartdir - ChartDirector
nsgdchart - for GDChart

Maybe these can be reused for the AOLServer.

Collapse
Posted by Matthew Burke on
nschartdir and nsgdchart work just fine with AOLserver.

I've recently started on trying to better integrate nsgdchart with my AOLserver module, nsgd (*). Integration would allow one to use charting with arbitrary drawing on a single image (which would at least be useful to me).

As an aside I'll mention that I'm almost done with re-doing the API for nsgd. As the module currently stands it provides access to a good 90+ percent of the funcationality in gd 2.0.33, so it's worth taking a look at now (http://sourceforge.net/project/showfiles.php?group_id=3152). The reorg of the API will IMNSHO make using the package much more logical.

If you have any thoughts on what you'd like to see in an nsgd/nsgdchar integration, or any related issues, let me know.

Matt

(*) Paraphrasing the nsgd TODO: I suppose you could say they are integrated now. You can write an image file with nsgdchart and then read it back in using nsgd...but I'd like something a little more flexible.

Collapse
Posted by Nima Mazloumi on
Matthew,
maybe you can take a look at my examples that I have added to the documentation.

The api of diagram is flexible in the sense that you can add your own way how the data is dealt with that was passed to template::diagram::create

See under diagram/resources/diagram/.. for examples.

Thus I believe for using nsgd one could write further templates like gdpie.adp

To ask template::diagram::create to use this template you call

db_multirow datasource select_objects $query

template::diagram::create \
    -name dia1 \
    -multirow datasource \
    -title "Objects" \
    -x_label "Time" \
    -y_label "Count" \
    -left $left -top $top -right $width -bottom $height \
    -scales "$x_scale $y_scale" \
    -template gdpie \
    -elements {
        d1 {
            color "#$d1_color"
            label "Pie 1"
            size $size
        }
    }
What do you think?
Collapse
Posted by Matthew Burke on
Nima,

Interesting stuff. As soon as the beginning-of-semester rush slows down a little bit, I'll look at it in more details.

Thanks,

Matt