Ranking
Quick Tutorial | Ranking
The rank formula function determines the ordered numerical ranking of an element across a set. The function takes two parameters, a value or expression for the current object being evaluated, and a list of values for the set. For example:
rank(7,[3,4,18,7,2])
will yield 2, as 7 is the second largest value in the set.
The values of both parameters may either be single values (scalar, as in the example above), or times series, and may be derived as the result of other functions. For example, given a space with a set of objects each having a “score” time series attributes, one can map a feature, such as “Color”, “Y Position”, etc. to the formula:
rank(a,peers(a))
with variable a being set to the attribute “score”, and each object will evaluate to its numerical ranking among all objects in the space, at each date in the time series. The peers function returns all the values of every object/relation in the same group or space. Other useful functions to provide the comparison set include children, relation, related, global_relation, global_related, and parent.
The use of rank in evaluation of the Visibility feature enables the user to show an ever-changing “top N” set of objects, hiding those not among the top N.
Additional Note: you may to have only the ‘top 10’ in your space. To do this you expand or paste relations or objects into a space. Then set visibility to “min(values(rank(a,peers(a))))<=10” This gives you the top 10 at *any* time in the ranking—of course with a time series the top 10 might have 13 or more total objects, as some enter the top 10 as others drop out. Then select all in the scene and copying only those objects to a second space/group.