Also, need I define "my_float_field__range"? Thanks On Fri, Sep 10, 2010 at 6:52 PM, Lucian Romi <romi.luc...@gmail.com> wrote: > Hi, Sebastien > > Follow your instruction, I was able to create a Cube object and define > sample_space. > However, I don't know how to retrieve the measure result. Can you tell > me how to do that? > What do you mean by "instantiate a cube with a base queryset, and use > one of the methods > provided to calculate the statistics" > > Thanks. > > On Tue, Aug 31, 2010 at 1:33 AM, sebastien piquemal <seb...@gmail.com> wrote: >> To integrate a calculated value with search features from admin app, I >> don't know any other way than create and save a calculated field on >> your model ... >> This calculated field, you can calculate it with cube ... but if you >> don't use the Cube for any other statistic than that, it is too much >> overhead. >> >> On Aug 31, 5:30 am, Lucian Romi <romi.luc...@gmail.com> wrote: >>> Thanks Sebastien. >>> >>> Can I integrate Cube with filter and search features from the admin app? >>> Also, to make things simple, I'm going to use GChart, but I need >>> statistic data. >>> Let me download Cube and spend some time on it. Thanks. >>> >>> On Mon, Aug 30, 2010 at 4:16 PM, sebastien piquemal <seb...@gmail.com> >>> wrote: >>> > 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 >>> > athttp://groups.google.com/group/django-users?hl=en. >> >> -- >> 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. >> >> >
-- 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.