File tree 1 file changed +20
-8
lines changed
frontend/express/public/javascripts/countly/vue/components
1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change 539
539
noEmpty : {
540
540
type : Boolean ,
541
541
default : false
542
+ } ,
543
+ sortBy : {
544
+ type : String ,
545
+ default : "value" ,
546
+ required : false
542
547
}
543
548
} ,
544
549
data : function ( ) {
638
643
template += "<span class='chart-tooltip__header text-smaller font-weight-bold'>" + params [ 0 ] . axisValueLabel + "</span></br>" ;
639
644
}
640
645
641
- params . sort ( function ( a , b ) {
642
- if ( typeof a . value === 'object' ) {
643
- return b . value [ 1 ] - a . value [ 1 ] ;
644
- }
645
- else {
646
- return b . value - a . value ;
647
- }
648
- } ) ;
646
+ if ( self . sortBy === "index" ) {
647
+ params . sort ( function ( a , b ) {
648
+ return a . seriesIndex - b . seriesIndex ;
649
+ } ) ;
650
+ }
651
+ else {
652
+ params . sort ( function ( a , b ) {
653
+ if ( typeof a . value === 'object' ) {
654
+ return b . value [ 1 ] - a . value [ 1 ] ;
655
+ }
656
+ else {
657
+ return b . value - a . value ;
658
+ }
659
+ } ) ;
660
+ }
649
661
650
662
for ( var i = 0 ; i < params . length ; i ++ ) {
651
663
if ( params [ i ] . seriesName . toLowerCase ( ) === 'duration' || params [ i ] . seriesName . toLowerCase ( ) === 'avg. duration' ) {
You can’t perform that action at this time.
0 commit comments