Forum OpenACS Q&A: Graphing for OACS?

Collapse
Posted by Jerome M on
i was just wondering if there are projects for graphing for OACS..?

i already used the TGDGraph it works but i need it to be dynamic and something that would works on ADP pages..

TIA

Collapse
2: Re: Graphing for OACS? (response to 1)
Posted by Roberto Mello on
I think you meant Tgdchart.

Why isn't it dynamic? I've used it to generate dynamic graphs,  an example of which is shown in https://openacs.org/forums/message-view?message_id=44869, and I've used the generated graphs in the .adp.

Do you mean generating a graph without saving to a file? I think nsgd does that but IIRC you have to return _only_ the graph to the connection.

-Roberto

Collapse
3: Re: Graphing for OACS? (response to 1)
Posted by Vlad Seryakov on
Some time ago i wrote charting module using ChartDir C++ library and it works pretty good, we use it on our production site to produce monitoring charts.
ftp://ftp.crystalballinc.com/pub/vlad/nschartdir.tar.gz

There is chartdir.tar.gz distribution of this C++ library for Linux as well for convenience.

Collapse
4: Re: Graphing for OACS? (response to 1)
Posted by Steve Manning on
I have used inochart to create dynamic graphs in AOLServer. I can't find the home for this on the web anymore - I think its died but I still have the tar.gz for version 0.12 if your interested.
Collapse
5: Re: Graphing for OACS? (response to 2)
Posted by Jerome M on
dynamic in the sense that the page that produces the grpah doesnt query the same tables over and over again...

before in my page i usually place.. <img src=graph.tcl> to produce the graph together with the other forms and text..

but since ill be querying different tables depending on the parent page.. i think <img src=graph.tcl> wouldnt do the trick... unless ill be able to pass an argument to graph.tcl in the adp page.. such as <img src=graph.tcl $tables_to_query > but i dont think its possible (or i might be wrong)..

i found somewhat a sol'n but caused another problem..
i tried to place the code of graph.tcl in page1.tcl and from it @foo@ can be accessed from page2.adp.. and outputs the binary using <img src=<%[ns_writebinary @foo@]%>> but another problem arises it only output the image it didn't include my html text and forms..

Collapse
6: Re: Graphing for OACS? (response to 5)
Posted by Jamie Rasmussen on
There are many procs in OpenACS to help you pass variables between pages - look in https://openacs.org/api-doc/ for export_url_vars and ad_page_contract for instance, and grep through some of the packages you've installed for how they are used in practice.  In your case the link generated might look something like <IMG src="graph.tcl?table=foo">.
Collapse
7: Re: Graphing for OACS? (response to 6)
Posted by Jerome M on
no what i mean is pass an argument to a tcl script in a web page.. such as..

page1.adp
contains...
  <img src=graph.tcl @argv1@ @argv2@>

page1.tcl
contains...
  set argv "dyanmicvalue1"
  set argv "dynamicvalue2"

Collapse
8: Re: Graphing for OACS? (response to 3)
Posted by Jerome M on
vlad,

  set data [ns_chartdir image $chart]

  i got this line from one of your examples... is it possible to output the value of data which i think is the binary data of the chart from an adp page...

  because im stuck in the same situation... just like in tgdchart i cant output the image from  a variable.. when i used the ns_writebinary it only outputs the chart only. it didnt include text and form elements..

TIA

Collapse
9: Re: Graphing for OACS? (response to 7)
Posted by Jamie Rasmussen on
I think what you want is:

page1.adp contains...
  <img src=@graph_link@>

page1.tcl contains...
  set argv1 "dynamicvalue1"
  set argv2 "dynamicvalue2"
  set graph_link "graph.tcl?[export_url_vars argv1 argv2]"

You can see very similar code in various OpenACS packages.  For example, check out workflow-gif.tcl, case-state-graph.tcl, and case-state-graph.adp in packages/acs-workflow/www/