File tree Expand file tree Collapse file tree 1 file changed +6
-22
lines changed Expand file tree Collapse file tree 1 file changed +6
-22
lines changed Original file line number Diff line number Diff line change @@ -5,32 +5,16 @@ var debug = require('debug')('scout-ui:minicharts:unique');
5
5
module . exports = VizView . extend ( {
6
6
template : require ( './unique.jade' ) ,
7
7
derived : {
8
- orderedValues : {
9
- deps : [ 'model.values' ] ,
10
- cache : true ,
11
- fn : function ( ) {
12
- return this . model . values . toJSON ( ) . sort ( ) ;
13
- }
14
- } ,
15
- minValue : {
16
- deps : [ 'orderedValues' ] ,
17
- cache : true ,
18
- fn : function ( ) {
19
- return this . orderedValues [ 0 ] ;
20
- }
21
- } ,
22
- maxValue : {
23
- deps : [ 'orderedValues' ] ,
24
- cache : true ,
25
- fn : function ( ) {
26
- return this . orderedValues [ this . orderedValues . length - 1 ] ;
27
- }
28
- } ,
29
8
randomValues : {
30
9
deps : [ 'orderedValues' ] ,
31
10
cache : false ,
32
11
fn : function ( ) {
33
- return this . orderedValues . slice ( 1 , 15 ) ;
12
+ return _ ( this . model . values . sample ( 15 ) )
13
+ . map ( function ( x ) {
14
+ return x . value ;
15
+ } )
16
+ . sort ( )
17
+ . value ( ) ;
34
18
}
35
19
}
36
20
} ,
You can’t perform that action at this time.
0 commit comments