jjmontesl / cubesviewer

Explore and visualize analytical datasets
http://www.cubesviewer.com
Other
441 stars 112 forks source link

add weighted sort algorithm and option #57

Closed devvmh closed 8 years ago

devvmh commented 8 years ago

Uses algorithm from https://moz.com/blog/build-your-own-weighted-sort to implement google-analytics-style column sort

Currently only enabled on the explore view

To enable for a specific aggregate attribute, use this format:

    {
      "name": "fee_sum",
      "label": "Total Fees",
      "measure": "fee",
      "function": "sum",
      "info": {
        "cv-weighted-sort": "record_count"
      }
    },

The "record_count" in the example above refers to the column that determines the relative weight of the value. For instance, for the following four rows:

record_count   fee_sum
10             $4000
10000          $3000
10             $0
10000          $1000

the second row would be sorted more highly than the first, since there are so many more records, and the fourth row would be sorted as lower than the third, again because there are so many more records.

jjmontesl commented 8 years ago

This one looks to me quite specific and won't be merged atm. I guess a pluggable sorting mechanism would be desirable first.