List Info

Thread: dynamic chart creation (CP 2.2)




dynamic chart creation (CP 2.2)
user name
2006-11-02 22:43:56
Hi,
maybe someone here cab give me a clue on how to accomplish the following:
on http://www.serpia.org/water I am running a test with ChartDirector, this page includes a form that trggers the action "../makeGraph"
makeGraph is something like this:

        def makeGraph(self, howmuch):
  ;          # create a random string and concenate it to png
   ;         ...
   ;         # check values
        ;    ...
   ;         # Create the chart with ChartDirector
   ;         ....
         ;  
         ;   # The data for the bar chart
          ;  c.makeChart("../charts/"+a+"")
        ;   
         ;   result = []
 &nbsp;   ; &nbsp; &nbsp; &nbsp; result.append('<h1>Reporting the results!&lt;/h1>')
 &nbsp; &nbsp; &nbsp;   ; &nbsp; result.append('<img src="../charts/%s">' % a)
 &nbsp;   ; &nbsp; &nbsp; &nbsp; return 'n'.join(result)
&nbsp; &nbsp; &nbsp; &nbsp; makeGraph.exposed = True

So that the chart gets a random name and is diplayed on the webpage.
But, what I really want to do is displaying the chart on the ../water page (where the form also is)
I have tried doing a redirect from ../makeGraph to /water in stead of returning the result, but that only works if the filename is always the same (using <img=&quot; chart.png"&gt;. But I need a random name every time a Chart is created.
Any idea? Your help is appreciated!

Dimitri
--
---
You can't have everything. Where would you put it? -- Steven Wright
---
please visit www.serpia.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users&quot; group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

dynamic chart creation (CP 2.2)
user name
2006-11-02 23:20:26
dimitri pater wrote:
> Hi,
> maybe someone here cab give me a clue on how to
accomplish the following:
> on http://www.serpia.org/wat
er I am running a test with ChartDirector,
> this page includes a form that trggers the action
"../makeGraph"
> makeGraph is something like this:
>
>         def makeGraph(self, howmuch):
>             # create a random string and concenate it
to png
>             ...
>             # The data for the bar chart
>            
c.makeChart("../charts/"+a+"")
>            
>             result = []
>             result.append('<h1>Reporting the
results!</h1>')
>             result.append('<img
src="../charts/%s">' % a)
>             return 'n'.join(result)
>         makeGraph.exposed = True
>
> So that the chart gets a random name and is diplayed on
the webpage.
> But, what I really want to do is displaying the chart
on the ../water
> page (where the form also is)
> I have tried doing a redirect from ../makeGraph to
/water in stead of
> returning the result, but that only works if the
filename is always
> the same (using <img=" chart.png">. But
I need a random name every
> time a Chart is created.
> Any idea? Your help is appreciated!

There are several ways.  One way is to have an
<iframe> to hold your
chart, have some Javascript that refreshes it when the user
hits <submit>.

Another way is to use something like AJAX to fetch the file
name, and
modify the <img> tag on the fly to insert the new
filename.

-- 
Tim Roberts, timrprobo.com
Providenza & Boekelheide, Inc.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at ht
tp://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )