Browse Source

电视剧体裁结构

yufeng 3 years ago
parent
commit
07a886c635
1 changed files with 29 additions and 12 deletions
  1. 29 12
      src/main/webapp/static/js/analysis/theatre_analysis.js

+ 29 - 12
src/main/webapp/static/js/analysis/theatre_analysis.js

@@ -440,14 +440,27 @@ function getThemeChart(){
440 440
 		};
441 441
 	ajax("ajax_tv_theme.do",data,function(res){
442 442
 		if(res.code == 1 && res.data.length > 0){
443
-			var legend= [], series = [],xdata = [],ydata = [],zdata = [],html = "";
443
+			var legend= [], series = [],xdata = [],ydata = [],zdata = [],html = "", data1=[];
444 444
 			var xOther = 0;
445 445
 
446
-			$.each(res.data, function(index, item){
446
+            avg = res.data[res.data.length - 1];
447
+            // 去掉平均值后在排序
448
+            $.each(res.data, function(index, item){
449
+                if (index < res.data.length - 1) {
450
+                    data1.push(item);
451
+                }
452
+            });
453
+            data1 = data1.sort(function(a,b){
454
+                return b.total-a.total;
455
+            });
456
+			$.each(data1, function(index, item){
447 457
 			    legend.push(item.firstTheme);
448
-                if (index < 10 || index == res.data.length - 1) {
449
-                    ydata.push(item.firstTheme);
450
-                    zdata.push(item.ratio);
458
+                if (index < 10) {
459
+                    var lv1 = {
460
+                        value: item.total,
461
+                        name : item.firstTheme
462
+                    };
463
+                    xdata.push(lv1);
451 464
                 }
452 465
 
453 466
 				if (index >= 10){
@@ -455,15 +468,19 @@ function getThemeChart(){
455 468
 					return true;
456 469
 				}
457 470
 
471
+			});
472
+
473
+			data1 = data1.sort(function(a,b){
474
+                return b.ratio-a.ratio;
475
+            });
476
+            $.each(data1, function(index, item){
458 477
                 if (index < res.data.length - 1) {
459
-					var lv1 = {
460
-						value: item.total,
461
-						name : item.firstTheme
462
-					};
463
-                    xdata.push(lv1);
478
+                    ydata.push(item.firstTheme);
479
+                    zdata.push(item.ratio);
464 480
                 }
465
-
466
-			});
481
+            });
482
+            ydata.push(avg.firstTheme);
483
+            zdata.push(avg.ratio);
467 484
 
468 485
 			// 其它
469 486
 			if (xOther > 0){