I created an app to easily generate the stats part :
http://code.google.com/p/django-cube/ ; however you still have to
create the chart, for example with matplotlib :
http://www.scipy.org/Cookbook/Matplotlib/Django.

To create your stats with django-cube, you can use this code :

    from cube.models import Cube, Dimension

    class MyModelCube(Cube):
        my_dimension = Dimension(field='my_float_field__range',
sample_space=[(0, 1.5), (1.5, 6.2)])

        @static
        def aggregation(queryset):
            return queryset.count()/MyModel.objects.count() * 100

- You specify one dimension for the cube, this dimension refers to the
field lookup 'my_float_field__range' (where 'my_float_field' is of
course the name of your field)
- then you specify a sample space for this dimension, which in fact
means that you specify for which ranges the stats will be calculated
(here, on the ranges (0, 1.5) and (1.5, 6.2))
- then you write your aggregation function, which is in your case a
percentage calculation ('queryset' is the queryset filtered according
to the dimensions you will use while querying the cube, divided by the
total, multiplied by 100)
- finally, you instantiate a cube with a base queryset, and use one of
the methods provided to calculate the statistics

Ok, the doc is kind of bad for now, but I can help you if you want to
use it but you don't manage to do so.

On Aug 30, 8:24 pm, hollando <romi.luc...@gmail.com> wrote:
> I want to make a statistic app.
> There is a float field in my model(table).I want to use a chart to
> show what's the percentage in each range.
> Any suggestion to make such and app that can fit into django model.
> Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to