Re: Staticstic app, ask for idea.
You could run the django-cube tests ! If you don't give me the error trace, I cannot really help you ! On Sep 11, 8:10 pm, Lucian Romi wrote: > Thanks for your help. It's very clear. > I used measure_list method but it thrown and exception. > Here's how I did, > In my app's ModelAdmin I override changelist_view method. > I was able to get the queryset, then instantied cube with this queryset. > If I didn't call measure_list, everything works fine. But if I call > it, there is exception, but django didn't give much useful infomation > in stdout, and I'm going to debug it later. > If you aware of anything I'm doing wrong, please let me know. Or is > there any sample I can quickly run just to verify there is nothing > wrong with my enviroment. > Thanks. > > On Sat, Sep 11, 2010 at 7:40 AM, sebastien piquemal wrote: > > 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 > > > Basically when you declare a dimension, you can use any field-lookup > > from Django, so when I write 'my_float_field__range' it means : > > -> You said in your question "There is a float field in my > > model(table)", as you didn't tell the name of your "float field", I > > wrote : 'my_float_field' > > -> You said that you want the percentage in each range... so I used > > the field look-up '__range' from Django. > > > If your "float field" is called "gnagna", then you would declare your > > dimension like this : Dimension(field="gnagna__range", ... > > > Ok ... when you have declared this, you have a Cube class. After, you > > need to instantiate an object from this class, in order to use its > > methods ! To do this, you call the Cube constructor, with a queryset > > as argument : > instantiated_cube = MyModelCube(a_queryset) > > > Then, and only then, you can use the methods (all the calculations > > will be based on "a_queryset"). For exemple, if you want a list of > > measures : > my_measures = instantiated_cube.measure_list("my_dimension") > > > Considering the sample space I used to declare the dimension, this > > should give something like this : > my_measures > > [65, 29] > > Where 65 means "65% of the floats are in the range [0, 1.5]", 29 means > > "29% of the floats are in the range [1.5, 6.2]" > > > Is it clearer like this ? > > > On Sep 11, 4:04 am, Lucian Romi wrote: > >> Also, need I define "my_float_field__range"? Thanks > > >> On Fri, Sep 10, 2010 at 6:52 PM, Lucian Romi 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 > >> > 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 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 > >> >>> wrote: > >> >>> > I created an app to easily generate the stats part : > >> >>> >http://code.google.com/p/django-cube/;howeveryou 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
Re: Staticstic app, ask for idea.
Thanks for your help. It's very clear. I used measure_list method but it thrown and exception. Here's how I did, In my app's ModelAdmin I override changelist_view method. I was able to get the queryset, then instantied cube with this queryset. If I didn't call measure_list, everything works fine. But if I call it, there is exception, but django didn't give much useful infomation in stdout, and I'm going to debug it later. If you aware of anything I'm doing wrong, please let me know. Or is there any sample I can quickly run just to verify there is nothing wrong with my enviroment. Thanks. On Sat, Sep 11, 2010 at 7:40 AM, sebastien piquemal wrote: > 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 > > Basically when you declare a dimension, you can use any field-lookup > from Django, so when I write 'my_float_field__range' it means : > -> You said in your question "There is a float field in my > model(table)", as you didn't tell the name of your "float field", I > wrote : 'my_float_field' > -> You said that you want the percentage in each range... so I used > the field look-up '__range' from Django. > > If your "float field" is called "gnagna", then you would declare your > dimension like this : Dimension(field="gnagna__range", ... > > > Ok ... when you have declared this, you have a Cube class. After, you > need to instantiate an object from this class, in order to use its > methods ! To do this, you call the Cube constructor, with a queryset > as argument : instantiated_cube = MyModelCube(a_queryset) > > Then, and only then, you can use the methods (all the calculations > will be based on "a_queryset"). For exemple, if you want a list of > measures : my_measures = instantiated_cube.measure_list("my_dimension") > > Considering the sample space I used to declare the dimension, this > should give something like this : my_measures > [65, 29] > Where 65 means "65% of the floats are in the range [0, 1.5]", 29 means > "29% of the floats are in the range [1.5, 6.2]" > > Is it clearer like this ? > > On Sep 11, 4:04 am, Lucian Romi wrote: >> Also, need I define "my_float_field__range"? Thanks >> >> On Fri, Sep 10, 2010 at 6:52 PM, Lucian Romi 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 >> > 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 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 >> >>> 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
Re: Staticstic app, ask for idea.
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 Basically when you declare a dimension, you can use any field-lookup from Django, so when I write 'my_float_field__range' it means : -> You said in your question "There is a float field in my model(table)", as you didn't tell the name of your "float field", I wrote : 'my_float_field' -> You said that you want the percentage in each range... so I used the field look-up '__range' from Django. If your "float field" is called "gnagna", then you would declare your dimension like this : Dimension(field="gnagna__range", ... Ok ... when you have declared this, you have a Cube class. After, you need to instantiate an object from this class, in order to use its methods ! To do this, you call the Cube constructor, with a queryset as argument : >>> instantiated_cube = MyModelCube(a_queryset) Then, and only then, you can use the methods (all the calculations will be based on "a_queryset"). For exemple, if you want a list of measures : >>> my_measures = instantiated_cube.measure_list("my_dimension") Considering the sample space I used to declare the dimension, this should give something like this : >>> my_measures [65, 29] Where 65 means "65% of the floats are in the range [0, 1.5]", 29 means "29% of the floats are in the range [1.5, 6.2]" Is it clearer like this ? On Sep 11, 4:04 am, Lucian Romi wrote: > Also, need I define "my_float_field__range"? Thanks > > On Fri, Sep 10, 2010 at 6:52 PM, Lucian Romi 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 > > 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 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 > >>> 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 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 > >>> >
Re: Staticstic app, ask for idea.
Also, need I define "my_float_field__range"? Thanks On Fri, Sep 10, 2010 at 6:52 PM, Lucian Romi 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 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 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 >>> 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 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.
Re: Staticstic app, ask for idea.
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 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 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 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 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.
Re: Staticstic app, ask for idea.
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 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 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 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.
Re: Staticstic app, ask for idea.
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 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 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. > > -- 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.
Re: Staticstic app, ask for idea.
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 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.
Re: Staticstic app, ask for idea.
On 30 août, 20:24, hollando 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. Nope, but reposting the same question two times in two minutes under two different names won't help. -- 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.
Staticstic app, ask for idea.
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.