Graphs and Plots

View: New views
7 Messages — Rating Filter:   Alert me  

Graphs and Plots

by Jeroen Michiel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

For the project I'm working on, I need to draw lots of graphs and plots of statistical data.
I was thinking about matplotlib, but I don't find anything about it combined with Zope3/Grok.
Is there anything like that available somewhere?

If not, I'll have to do it myself, but I'm not sure what would be the best way to tackle this?
* Easiest would be to make separate views for each chart that I pass in the HTML img src attribute. However, that might incur extra overload, as I might have to do the same calculations twice or more: once for the main page and once for each graph or plot. I could try to cache the data somehow (session data or memcached), but that might complicate things. You could refer to a single graph by it's url, however, without ever needing the main HTML page.

* Another approach would be like the Google Chart API, that the graph data is encoded in the url, and that I have one generic view that can render any chart by changing the url GET params.
That, however, would force one to go to the main html page to get the right GET params to go with the graphs.

What would you guys suggest?
I personally think the view per chart with memcached as a possible later optimization would be best, but I'd like a 'second opinion' on this one.

Thanks!

Re: Graphs and Plots

by Fernando Correa Neto :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jun 16, 2009 at 10:56 AM, Jeroen Michiel<jmichiel@...> wrote:

> What would you guys suggest?
> I personally think the view per chart with memcached as a possible later
> optimization would be best, but I'd like a 'second opinion' on this one.

Actually flotr ( http://solutoire.com/flotr/docs/ ) would be a good
candidate to simplify your work.

-Fernando
_______________________________________________
Grok-dev mailing list
Grok-dev@...
http://mail.zope.org/mailman/listinfo/grok-dev

Re: Graphs and Plots

by modiadi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am doing a stok trader site and I also want to use graphs in the site.

At this point I am using a specialized view with a flash charting  
component inside.

I also need a simple solution for about 6 mini stock charts displayed  
on the entire site.
For this I made a couple of experiments with flot http://code.google.com/p/flot/ 
  (which may be the same as http://solutoire.com/flotr/docs/). My  
problem with this library is that it is drawing the charts directly in  
the browser. It loads from the server the chart data.
I am interested to replace it with something wich can produce an image  
file. It should be a server side solution without using a remote  
server like Google Chart. Probably in the next couple of weeks I will  
start working on it.
If you wish we can work on something together and after that share it  
with other grok users (if it will worth something ...)

Please let me know if you want to do that.

Anyway, I can show you what I did with flot, which is basically view  
based.  In this case the caching part is solved by the web server. The  
chart data is a simple file and with a clever configuration it can be  
cached.


Regards,

On 16 juin 09, at 15:56, Jeroen Michiel wrote:

>
> Hi all,
>
> For the project I'm working on, I need to draw lots of graphs and  
> plots of
> statistical data.
> I was thinking about matplotlib, but I don't find anything about it  
> combined
> with Zope3/Grok.
> Is there anything like that available somewhere?
>
> If not, I'll have to do it myself, but I'm not sure what would be  
> the best
> way to tackle this?
> * Easiest would be to make separate views for each chart that I pass  
> in the
> HTML img src attribute. However, that might incur extra overload, as  
> I might
> have to do the same calculations twice or more: once for the main  
> page and
> once for each graph or plot. I could try to cache the data somehow  
> (session
> data or memcached), but that might complicate things. You could  
> refer to a
> single graph by it's url, however, without ever needing the main  
> HTML page.
>
> * Another approach would be like the Google Chart API, that the  
> graph data
> is encoded in the url, and that I have one generic view that can  
> render any
> chart by changing the url GET params.
> That, however, would force one to go to the main html page to get  
> the right
> GET params to go with the graphs.
>
> What would you guys suggest?
> I personally think the view per chart with memcached as a possible  
> later
> optimization would be best, but I'd like a 'second opinion' on this  
> one.
>
> Thanks!
> --
> View this message in context: http://www.nabble.com/Graphs-and-Plots-tp24054863p24054863.html
> Sent from the Grok mailing list archive at Nabble.com.
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev@...
> http://mail.zope.org/mailman/listinfo/grok-dev
>

_______________________________________________
Grok-dev mailing list
Grok-dev@...
http://mail.zope.org/mailman/listinfo/grok-dev

Re: Graphs and Plots

by Sebastian Ware :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You could use reportlab

   http://www.reportlab.org/

It will generate any chart you need and you can output it as an image  
or PDF.

Mvh Sebastian

16 jun 2009 kl. 16.52 skrev modiadi:

> Hi,
>
> I am doing a stok trader site and I also want to use graphs in the  
> site.
>
> At this point I am using a specialized view with a flash charting
> component inside.
>
> I also need a simple solution for about 6 mini stock charts displayed
> on the entire site.
> For this I made a couple of experiments with flot http://code.google.com/p/flot/
>  (which may be the same as http://solutoire.com/flotr/docs/). My
> problem with this library is that it is drawing the charts directly in
> the browser. It loads from the server the chart data.
> I am interested to replace it with something wich can produce an image
> file. It should be a server side solution without using a remote
> server like Google Chart. Probably in the next couple of weeks I will
> start working on it.
> If you wish we can work on something together and after that share it
> with other grok users (if it will worth something ...)
>
> Please let me know if you want to do that.
>
> Anyway, I can show you what I did with flot, which is basically view
> based.  In this case the caching part is solved by the web server. The
> chart data is a simple file and with a clever configuration it can be
> cached.
>
>
> Regards,
>
> On 16 juin 09, at 15:56, Jeroen Michiel wrote:
>
>>
>> Hi all,
>>
>> For the project I'm working on, I need to draw lots of graphs and
>> plots of
>> statistical data.
>> I was thinking about matplotlib, but I don't find anything about it
>> combined
>> with Zope3/Grok.
>> Is there anything like that available somewhere?
>>
>> If not, I'll have to do it myself, but I'm not sure what would be
>> the best
>> way to tackle this?
>> * Easiest would be to make separate views for each chart that I pass
>> in the
>> HTML img src attribute. However, that might incur extra overload, as
>> I might
>> have to do the same calculations twice or more: once for the main
>> page and
>> once for each graph or plot. I could try to cache the data somehow
>> (session
>> data or memcached), but that might complicate things. You could
>> refer to a
>> single graph by it's url, however, without ever needing the main
>> HTML page.
>>
>> * Another approach would be like the Google Chart API, that the
>> graph data
>> is encoded in the url, and that I have one generic view that can
>> render any
>> chart by changing the url GET params.
>> That, however, would force one to go to the main html page to get
>> the right
>> GET params to go with the graphs.
>>
>> What would you guys suggest?
>> I personally think the view per chart with memcached as a possible
>> later
>> optimization would be best, but I'd like a 'second opinion' on this
>> one.
>>
>> Thanks!
>> --
>> View this message in context: http://www.nabble.com/Graphs-and-Plots-tp24054863p24054863.html
>> Sent from the Grok mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Grok-dev mailing list
>> Grok-dev@...
>> http://mail.zope.org/mailman/listinfo/grok-dev
>>
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev@...
> http://mail.zope.org/mailman/listinfo/grok-dev

_______________________________________________
Grok-dev mailing list
Grok-dev@...
http://mail.zope.org/mailman/listinfo/grok-dev

Re: Graphs and Plots

by Jeroen Michiel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the info, guys!

Flot and flotr look nice, and since they run client-side it solves the problem of recalculating for each plot, but the images can't be generated standalone, I gather. Also, the supported graphtypes are somewhat limited.
My project is for scientific research, so I want to keep the largest set of graphtypes available.

That leaves me with matplotlib (http://matplotlib.sourceforge.net/index.html) and ReportLab (http://www.reportlab.org/) (thx for this one Sebastian).
I can hardly decide on one of those... matplotlib doesn't seem to install without extra effort using easy_install on Windows, though.
Does anyone know if there are any significant differences between the 2 (potential-wise), because both seem equally able to me.

Re: Graphs and Plots

by Sebastian Ware :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Reportlab allows you to generate professional looking PDF documents.  
You might find a broader use of it making it a better investment to  
learn than a pure graphing framework.

Mvh Sebastian


17 jun 2009 kl. 10.39 skrev Jeroen Michiel:

>
> Thanks for the info, guys!
>
> Flot and flotr look nice, and since they run client-side it solves the
> problem of recalculating for each plot, but the images can't be  
> generated
> standalone, I gather. Also, the supported graphtypes are somewhat  
> limited.
> My project is for scientific research, so I want to keep the largest  
> set of
> graphtypes available.
>
> That leaves me with matplotlib
> (http://matplotlib.sourceforge.net/index.html) and ReportLab
> (http://www.reportlab.org/) (thx for this one Sebastian).
> I can hardly decide on one of those... matplotlib doesn't seem to  
> install
> without extra effort using easy_install on Windows, though.
> Does anyone know if there are any significant differences between  
> the 2
> (potential-wise), because both seem equally able to me.
> --
> View this message in context: http://www.nabble.com/Graphs-and-Plots-tp24054863p24069343.html
> Sent from the Grok mailing list archive at Nabble.com.
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev@...
> http://mail.zope.org/mailman/listinfo/grok-dev

_______________________________________________
Grok-dev mailing list
Grok-dev@...
http://mail.zope.org/mailman/listinfo/grok-dev

Re: Graphs and Plots

by Jeroen Michiel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'll experiment with both and see what I'll chose.

What I would like to do is make a grokker for specialization of a grok.View to generate such dynamic graphs, that automatically creates a graph object in the background and outputs it in it's render function while setting the appropriate Content-Type, so that I can simply make a view derived from it and create the actual data series in the update function.

Something like this:

class MySpread(Plot)
   grok.context(IStatisticalData)
   grok.name('spread')

   def update(self)
        self.graph.plot(data)

I've read about how to make your own grokkers and stuff, and I think I understand most of it, except for this: what I'm trying to do is make a special sort of view, so should I derive my Plot class from grok.View or from BrowserPage, and can I derive the grokker from the ViewGrokker in grokcore to simplify things and make sure it behaves as a regular grok View for the rest, or do I have to do it al over myself?