1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033 |
- angular.module('push')
- .controller('statisticalcenterCtrl', function (dataToolsService, $stateParams,$scope,ionicDatePicker, CommentService, UserService, UtilService, $timeout, CommonService,$ionicPopup) {
- $scope.modes=[
- {mode:"默认模式",id:0},
- {mode:"动态模式",id:1}
- ]
- $scope.selectMode= $scope.modes[0].id;
- $scope.node=UserService.node
- var date=new Date()
- $scope.year=[date.getFullYear()]
- for(var i=0 ; i<date.getFullYear()-2018 ;i++){
- console.log(i)
- $scope.year.push($scope.year[i]-1)
- }
- console.log( $scope.year)
- $scope.selectyear=date.getFullYear()
- var num=0,
- Carousel
- dataToolsService.getStatisticalCenterList().then(function (res) {
- if (res.code == 3350) {
- console.log(res)
- $scope.indexid=res.data.indexid;
- $scope.datalist = res.data.statisticalCenters;
- $scope.data=res.data;
- if($stateParams.datalist){
- $scope.datalist=$stateParams.datalist
- angular.forEach($scope.datalist, function (val) {
- console.log(val)
- if(val.isSelected==true){
- $scope.changeIndex(val)
- }
- })
- }else if($scope.datalist.length > 0) {
- $scope.datalist[0].isSelected = true;
- if ($scope.datalist[0].sonCenterList.length > 0) {
- $scope.datalist[0].sonCenterList[0].isSelected = true;
- }
- }
- $scope.datalist.push({
- indexname:'用户',
- indexid:1,
- sonCenterList:[{indexname:'用户',}],
- })
- getIndexChart();
- }
- })
- $scope.ggggg=function (){
- console.log(333)
- // 日期选择
- var datePickerObj = {
- //选择日期后的回掉
- callback: function (val) {
- if (typeof (val) === 'undefined') {
- } else {
- var date = new Date(val);
- if (date.toLocaleString().charAt(/\s+/) != -1) {
- var temp = date.toLocaleString().replace(/\//g, "-");
- obj.value = temp;
- }
- datePickerObj.inputDate = new Date(val); //更新日期弹框上的日期
- }
- },
- // closeOnSelect: true, //可选,设置选择日期后是否要关掉界面。呵呵,原本是false。
- };
- ionicDatePicker.openDatePicker(datePickerObj);
- }
- $scope.goback=function(){
- $scope.go("tab.activityIndex")
- clearInterval(Carousel)
- }
- $scope.greetname={}
- $scope.changeMode=function (data) {
- if(data==1){
- $ionicPopup.confirm({
- title: '确定',
- template: ' <div class="list">\n' +
- ' <label class="item item-input">\n' +
- ' <span class="input-label">轮播时间:</span>\n' +
- ' <input type="text" ng-model="greetname.time" placeholder="请填写正整数(毫秒)">\n' +
- ' </label>\n' +
- ' <label class="item item-input">\n' +
- ' <span class="input-label">欢迎语句:</span>\n' +
- ' <input type="text" ng-model="greetname.name">\n' +
- ' </label>\n' +
- ' </div>',
- scope: $scope,
- buttons: [ {
- text: '确定',
- type: 'button-positive',
- onTap: function(e) {
- var r = /^\+?[1-9][0-9]*$/
- if(!r.test($scope.greetname.time)){
- CommonService.showMessage("请填写轮播时间只能是正整数", $scope);
- e.preventDefault();
- }else {
- $scope.Carouselif=true
- }
- }
- }]
- });
- }else {
- clearInterval(Carousel)
- }
- }
- $scope.clickCarousel=function (){
- $scope.Carouselif=false
- Carousel=setInterval(function (){fff()},$scope.greetname.time)
- }
- var dlindex=1
- var fff=function (){
- if(dlindex==4){
- dlindex=0
- }
- $scope.changeIndex( $scope.datalist[dlindex],false)
- dlindex++
- }
- $scope.changeIndex=function (data,ifs) {
- if(ifs){
- $scope.selectMode= $scope.modes[0].id;
- clearInterval(Carousel)
- }
- for(var i = 0; i < $scope.datalist.length; i++) {
- $timeout(function () {
- $scope.indexid++
- }, 2000)
- }
- angular.forEach($scope.datalist, function (res1) {
- res1.isSelected = false;
- angular.forEach(res1.sonCenterList, function (res2) {
- res2.isSelected = false;
- })
- })
- data.isSelected = true;
- if (data.sonCenterList && data.sonCenterList.length > 0) {
- data.sonCenterList[data.indexid-1].isSelected = true;
- getIndexChart();
- }
- // if (data.indexname == "科技成果转化" || data.indexname == "其他") {
- // if (data.indexname == "科技成果转化") {
- // getIndexChart();
- // }
- ;
- }
- $scope.changeSonIndex = function (data, soncenter) {
- angular.forEach($scope.datalist, function (res1) {
- res1.isSelected = false;
- angular.forEach(res1.sonCenterList, function (res2) {
- res2.isSelected = false;
- })
- })
- angular.forEach($scope.datalist, function (res1) {
- angular.forEach(res1.sonCenterList, function (res2) {
- if (soncenter.indexname == res2.indexname) {
- res1.isSelected = true;
- }
- })
- })
- soncenter.isSelected = true;
- getIndexChart();
- }
- $scope.indexname = "";
- $scope.fatherindexname = "";
- var getIndexChart = function () {
- for (var i = 0; i < $scope.datalist.length; i++) {
- for (var j = 0; j < $scope.datalist[i].sonCenterList.length; j++) {
- if ($scope.datalist[i].sonCenterList[j].isSelected) {
- $scope.indexname = $scope.datalist[i].sonCenterList[j].indexname;
- $scope.fatherindexname = $scope.datalist[i].indexname;
- $scope.selectnum=$scope.datalist[i].indexid;
- break;
- }
- }
- }
- if ($scope.datalist[3].indexname == "科技成果转化" && $scope.datalist[3].isSelected) {
- $scope.fatherindexname = "科技成果转化";
- }
- // if ($scope.datalist[4].indexname == "其他" && $scope.datalist[4].isSelected) {
- // $scope.fatherindexname = "其他";
- // }
- //图表清空
- clearEchart();
- if ($scope.fatherindexname == "企业") {
- getBarChart(6, "企业类型", "企业库企业类型统计", '');
- getPieChart(6, "产业领域", "企业产业领域分布", 1);
- }
- if ($scope.fatherindexname == "人才") {
- if (UserService.node == '330122000') {
- getBarChart(38, "人才等级", "人才库人才级别统计", '');
- }
- if (UserService.node != '330122000') {
- getBarChart(38, "人才级别", "人才库人才级别统计", '');
- }
- getPieChart(38, "产业类型", "人才产业类型分布", 1);
- getBarChartForTalentacademic(38, "人才学历", "人才学历统计");
- }
- if ($scope.fatherindexname == "知识产权") {
- getBarChartForIntellecture(66, "企业专利类型情况统计");
- }
- if ($scope.fatherindexname == "科技成果转化") {
- getBarChartForAchieveTrans(77, "供需转化统计");
- getPieChart(77, "需求对接", "需求对接统计", 22);
- getPieChart(77, "需求类型", "需求类型统计", 41);
- getBarChartForCategory(77, "科技成果转化产业领域", "成果转化领域统计",30);
- }
- if($scope.fatherindexname == "用户"){
- setTimeout(() => {
- getactiveStatistics($scope.selectyear) ;
- yearActiveStatistics();
- getcount()
- }, 0)
- }
- // if ($scope.fatherindexname == "其他") {
- // getBarChartForOthers(88, "");
- // }
- }
- //图表清空
- var clearEchart = function () {
- if (document.getElementById('main') != null) {
- document.getElementById('main').innerHTML = "";
- document.getElementById('main').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main1') != null) {
- document.getElementById('main1').innerHTML = "";
- document.getElementById('main1').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main11') != null) {
- document.getElementById('main11').innerHTML = "";
- document.getElementById('main11').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main12') != null) {
- document.getElementById('main12').innerHTML = "";
- document.getElementById('main12').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main14') != null) {
- document.getElementById('main14').innerHTML = "";
- document.getElementById('main14').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main21') != null) {
- document.getElementById('main21').innerHTML = "";
- document.getElementById('main21').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main22') != null) {
- document.getElementById('main22').innerHTML = "";
- document.getElementById('main22').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main30') != null) {
- document.getElementById('main30').innerHTML = "";
- document.getElementById('main30').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main41') != null) {
- document.getElementById('main41').innerHTML = "";
- document.getElementById('main41').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main42') != null) {
- document.getElementById('main42').innerHTML = "";
- document.getElementById('main42').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main121') != null) {
- document.getElementById('main121').innerHTML = "";
- document.getElementById('main121').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main122') != null) {
- document.getElementById('main122').innerHTML = "";
- document.getElementById('main122').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main130') != null) {
- document.getElementById('main130').innerHTML = "";
- document.getElementById('main130').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main141') != null) {
- document.getElementById('main141').innerHTML = "";
- document.getElementById('main141').removeAttribute("_echarts_instance_");
- }
- if (document.getElementById('main142') != null) {
- document.getElementById('main142').innerHTML = "";
- document.getElementById('main142').removeAttribute("_echarts_instance_");
- }
- }
- $scope.emitContract=function (val){
- console.log(val)
- getactiveStatistics(val)
- }
- //用户统计
- var getactiveStatistics= function (val){
- dataToolsService.getactiveStatistics({year:val}).then((res)=>{
- getlineChart('用户月活跃度',res.data,
- ['1月', '2月', '3月', '4月', '5月', '6月', '7月','8月', '9月', '10月', '11月', '12月'],'lineuser1')
- })
- }
- //用户统计
- var yearActiveStatistics= function (val){
- dataToolsService.yearActiveStatistics().then((res)=>{
- if(res.code==3350){
- let xAxis=[],data=[]
- res.data.forEach((res)=>{
- xAxis.unshift(res.year)
- data.unshift(res.total)
- })
- getlineChart('用户年活跃度',data,xAxis,'lineuser2')
- }
- })
- }
- //用户统计
- var getcount= function (val){
- dataToolsService.getcount().then((res)=>{
- console.log(res)
- $scope.Totalusers=res.data
- })
- }
- //折线图
- var getlineChart=function (text,val,xdata,id){
- console.log("ddd")
- var myChart = echarts.init(document.getElementById(id));
- var option = {
- title: {
- text: text,
- },
- xAxis: {
- type: 'category',
- data: xdata
- },
- yAxis: {
- type: 'value',
- axisLabel: {
- formatter: '{value}人'
- }
- },
- series: [
- {
- data: val,
- type: 'line',
- smooth: true,
- lineStyle:{
- color:'rgb(128, 255, 165)'
- },
- areaStyle: {
- opacity: 0.8,
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: 'rgb(128, 255, 165)'
- },
- {
- offset: 1,
- color: 'rgb(1, 191, 236)'
- }
- ])
- },
- }
- ]
- };
- myChart.setOption(option);
- }
- //绘制企业类型柱状图
- var getBarChart = function (restype, indexname, text, sort) {
- dataToolsService.getBarValue(indexname, restype).then(function (res) {
- console.log(res)
- if (res.code == 3350) {
- $scope.xAxisData = [];
- $scope.yAxisData = [];
- for (var i = 0; i < res.data.length; i++) {
- $scope.xAxisData.push(res.data[i].type);
- $scope.yAxisData.push(res.data[i].num);
- }
- //绘图部分sort
- var myChart = null;
- if ($scope.isapp) {
- myChart = echarts.init(document.getElementById('main' + sort));
- } else {
- myChart = echarts.init(document.getElementById('main11'));
- }
- // console.log($scope.data)
- // 指定图表的配置项和数据
- var option = {
- title: {
- text: text,
- subtext:res.otherObj,
- subtextStyle:{
- color:"#ff0000",
- fontSize: 12,
- }
- },
- tooltip: {},
- legend: {
- data: ['数量']
- },
- grid: {
- containLabel: true,
- },
- toolbox: {
- feature: {
- myTool1: {
- show: $scope.data.isShowEdit,
- // show:true,
- title: '编辑',
- icon: 'image://img/bianji.png',
- onclick: function (){
- $scope.go("Statisticseditor",{mapList : res.data,datalist:$scope.datalist})
- }
- },
- }
- },
- xAxis: {
- data: $scope.xAxisData,
- axisLabel: {
- show: true,
- rotate: 60,
- textStyle: {
- fontSize: 14,
- color: '#686666',
- fontWeight: 'normal',
- }
- }
- },
- yAxis: {
- textStyle: {
- fontSize: 14,
- color: '#686666',
- fontWeight: 'normal',
- }
- },
- series: [{
- // barWidth: 50,
- type: 'bar',
- data: $scope.yAxisData,
- label: {
- show: "true",
- position: "top",
- fontWeight: "bolder",
- color: '#c23531',
- fontSize: "14"
- }
- }]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- myChart.on('click', function (params) {
- //params包含很多的信息 下标索引 如横坐标名称 对应的值
- // console.log("click",params);
- });
- }
- })
- }
- //绘制产业领域饼状图
- var getPieChart = function (restype, indexname, text, sort) {
- dataToolsService.getBarValue(indexname, restype).then(function (res) {
- // console.log(res)
- if (res.code == 3350) {
- $scope.axisData = [];
- angular.forEach(res.data, function (res) {
- var data = {
- value: res.num,
- name: res.type
- }
- $scope.axisData.push(data);
- })
- var myChart = null;
- if ($scope.isapp) {
- if ($scope.fatherindexname == "科技成果转化") {
- myChart = echarts.init(document.getElementById('main1' + sort));
- } else {
- myChart = echarts.init(document.getElementById('main' + sort));
- }
- } else {
- if ($scope.fatherindexname == "科技成果转化") {
- myChart = echarts.init(document.getElementById('main' + sort));
- } else {
- /*if ($scope.fatherindexname == "人才") {
- }else{
- myChart = echarts.init(document.getElementById('main1'));
- }*/
- myChart = echarts.init(document.getElementById('main12'));
- }
- }
- var option = {
- title: {
- show: true,
- text: text,
- position: 'center',
- subtext:res.otherObj,
- subtextStyle:{
- color:"#ff0000",
- fontSize: 12,
- }
- },
- grid: {
- containLabel: true,
- },
- toolbox: {
- feature: {
- myTool1: {
- show: $scope.data.isShowEdit,
- // show:true,
- title: '编辑',
- icon: 'image://img/bianji.png',
- onclick: function (){
- $scope.go("Statisticseditor",{mapList : res.data,datalist:$scope.datalist})
- }
- },
- }
- },
- series: [
- {
- name: text,
- type: 'pie', // 设置图表类型为饼图
- center:$scope.isapp?['50%', '50%']: ['25%', '50%'],
- radius: ['35%', '80%'], // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
- hoverAnimation: true,
- avoidLabelOverlap: true,
- data: $scope.axisData,// 数据数组,name 为数据项名称,value 为数据项值
- label: {
- normal: {
- show: false,
- position: 'center',
- formatter: '{b}\n{c}({d}%)',
- },
- emphasis: {
- show: true,
- textStyle: {
- fontSize: '15',
- fontWeight: 'bold',
- fontFamily: 'Microsoft YaHei'
- }
- }
- },
- labelLine: {
- normal: {
- show: false
- }
- },
- }
- ],
- legend: {
- type: 'scroll',
- orient: $scope.isapp?'horizontal':'vertical',
- // selectedMode: false, // 图例选择的模式,控制是否可以通过点击图例改变系列的显示状态。默认开启图例选择,可以设成 false 关闭。
- right: 0,
- top: 20,
- y: 'center',
- formatter: function (name) {
- var data = option.series[0].data;
- var total = 0;
- var tarValue;
- for (var i = 0, l = data.length; i < l; i++) {
- total += data[i].value;
- if (data[i].name == name) {
- tarValue = data[i].value;
- }
- }
- var p = 0;
- if (total > 0) {
- p = (tarValue / total * 100).toFixed(2);
- }
- return name + tarValue + '(' + p + '%)';
- },
- textStyle: { // 图例的公用文本样式。
- fontSize: 13,
- color: '#000',
- fontFamily: 'Microsoft YaHei'
- },
- data: $scope.axisData
- }
- }
- myChart.setOption(option);
- // myChart.dispatchAction({type: 'highlight', seriesIndex: 0, dataIndex: 0});
- // // 当鼠标移入时,如果不是第一项,则把当前项置为选中,如果是第一项,则设置第一项为当前项
- // var index=0
- // myChart.on('mouseover', function (e) {
- // console.log(e)
- // // myChart.dispatchAction({type: 'downplay', seriesIndex: 0, dataIndex: 0});
- // if (e.dataIndex != index) {
- // myChart.dispatchAction({type: 'downplay', seriesIndex: 0, dataIndex: index});
- // }
- // // if (e.dataIndex == 0) {
- // // myChart.dispatchAction({type: 'highlight', seriesIndex: 0, dataIndex: e.dataIndex});
- // // }
- // });
- // //
- // // //当鼠标离开时,把当前项置为选中
- // myChart.on('mouseout', function (e) {
- // index = e.dataIndex;
- // myChart.dispatchAction({type: 'highlight', seriesIndex: 0, dataIndex: e.dataIndex});
- // });
- }
- })
- }
- //人才学历统计专用
- var getBarChartForTalentacademic = function (restype, indexname, text) {
- dataToolsService.getBarChartForTalentacademic(indexname, restype).then(function (res) {
- if (res.code == 3350) {
- console.log(res)
- $scope.handleedit=function(){
- $scope.go("Statisticseditor",{datalist:$scope.datalist,tableList : res.data})
- }
- // console.log(res.data)
- $scope.typetalentdatalist = res.data;
- $scope.talentAcademicText = text;
- $scope.talentAcademictime = res.otherObj;
- // $scope.title1 = "电子信息";
- // $scope.title2 = "生物与新医药";
- // $scope.title3 = "航空航天";
- // $scope.title4 = "新材料";
- // $scope.title5 = "高技术服务";
- // $scope.title6 = "新能源与节能";
- // $scope.title7 = "资源与环境";
- // $scope.title8 = "先进制造与自动化";
- // $scope.title9 = "新能源汽车产业";
- // $scope.title10 = "临空产业";
- // $scope.title11 = "高端装备产业";
- // $scope.title14 = "其他";
- $scope.total=0
- $scope.num1 = 0;
- $scope.rate1 = 0;
- $scope.num2 = 0;
- $scope.rate2 = 0;
- $scope.num3 = 0;
- $scope.rate3 = 0;
- $scope.num4 = 0;
- $scope.rate4 = 0;
- $scope.num5 = 0;
- $scope.rate5 = 0;
- $scope.num6 = 0;
- $scope.rate6 = 0;
- $scope.num7 = 0;
- $scope.rate7 = 0;
- angular.forEach($scope.typetalentdatalist, function (res) {
- $scope.total+=res.mannum+res.womannum
- $scope.num1 += res.mannum;
- $scope.num2 += res.womannum;
- $scope.num3 += res.doctornum;
- $scope.num4 += res.masternum;
- $scope.num5 += res.degreenum;
- $scope.num6 += res.highnum;
- $scope.num7 += res.vicenum;
- })
- $scope.rate1 = toPercent($scope.num1/($scope.total==0?1:$scope.total));
- $scope.rate2 = toPercent($scope.num2/($scope.total==0?1:$scope.total));
- $scope.rate3 = toPercent($scope.num3/($scope.total==0?1:$scope.total));
- $scope.rate4 = toPercent($scope.num4/($scope.total==0?1:$scope.total));
- $scope.rate5 = toPercent($scope.num5/($scope.total==0?1:$scope.total));
- $scope.rate6 = toPercent($scope.num6/($scope.total==0?1:$scope.total));
- $scope.rate7 = toPercent($scope.num7/($scope.total==0?1:$scope.total));
- }
- })
- }
- //把小数转换成百分数
- var toPercent = function (point) {
- // console.log(point)
- if (point == 0) {
- return 0;
- }
- if (point == 1) {
- return "100%";
- }
- var str = String(point.toFixed(2) * 100).slice(0, 2) + "%";
- return str;
- }
- //企业专利类型情况统计
- var getBarChartForIntellecture = function (restype, text) {
- //获取拥有知识产权的企业的数量
- dataToolsService.getHaveIntellectureNum().then(function (res) {
- if (res.code == 3350) {
- console.log(res)
- $scope.intellectureTotalNum = res.data[0].num;
- $scope.intellectureTotaltime = res.otherObj;
- $scope.handlefirmedit=function () {
- $scope.go("Statisticseditor",{mapList:res.data,datalist:$scope.datalist})
- }
- }
- })
- dataToolsService.getBarChartForIntellecture($scope.fatherindexname, restype).then(function (res) {
- if (res.code == 3350) {
- $scope.xAxisData = [];
- $scope.yAxisData = [];
- for (var i = 0; i < res.data.length; i++) {
- $scope.xAxisData.push(res.data[i].type);
- $scope.yAxisData.push(res.data[i].num);
- }
- //绘图部分
- var myChart = null;
- if ($scope.isapp) {
- myChart = echarts.init(document.getElementById('main'));
- } else {
- myChart = echarts.init(document.getElementById('main11'));
- }
- // 指定图表的配置项和数据
- var option = {
- title: {
- text: text,
- subtext:res.otherObj,
- subtextStyle:{
- color:"#ff0000",
- fontSize: 12,
- }
- },
- grid: {
- containLabel: true,
- },
- tooltip: {},
- legend: {
- data: ['数量']
- },
- toolbox: {
- feature: {
- myTool1: {
- show: $scope.data.isShowEdit,
- // show:true,
- title: '编辑',
- icon: 'image://img/bianji.png',
- onclick: function (){
- $scope.go("Statisticseditor",{mapList : res.data,datalist:$scope.datalist})
- }
- },
- }
- },
- xAxis: {
- data: $scope.xAxisData,
- axisLabel: {
- show: true,
- textStyle: {
- fontSize: 14,
- color: '#686666',
- fontWeight: 'normal',
- }
- }
- },
- yAxis: {
- textStyle: {
- fontSize: 14,
- color: '#686666',
- fontWeight: 'normal',
- }
- },
- series: [{
- barWidth: 50,
- type: 'bar',
- data: $scope.yAxisData,
- label: {
- show: "true",
- position: "top",
- fontWeight: "bolder",
- color: '#c23531',
- fontSize: "14"
- }
- }]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- }
- })
- }
- //科技成果转化产业领域
- var getBarChartForCategory = function (restype, indexname, text, sort) {
- dataToolsService.getBarChartForCategory(indexname, restype).then(function (res) {
- // console.log(res)
- if (res.code == 3350) {
- $scope.list = res.data;
- dataToolsService.getCategoryList(indexname, restype).then(function (res1) {
- if (res1.code == 3350) {
- $scope.xAxisData1 = res1.data;
- $scope.demandCategortList = [];
- $scope.supplyCategortList = [];
- $scope.brokerCategortList = [];
- for (var i = 0; i < $scope.xAxisData1.length; i++) {
- for (var j = 0; j < $scope.list.length; j++) {
- if ($scope.xAxisData1[i] == $scope.list[j].type) {
- if ($scope.list[j].fathertype == "需求") {
- $scope.demandCategortList.push($scope.list[j].num);
- }
- if ($scope.list[j].fathertype == "供给") {
- $scope.supplyCategortList.push($scope.list[j].num);
- }
- if ($scope.list[j].fathertype == "经纪人") {
- $scope.brokerCategortList.push($scope.list[j].num);
- }
- }
- }
- }
- //绘图部分
- var myChart = null;
- if ($scope.isapp) {
- myChart = echarts.init(document.getElementById('main1' + sort));
- } else {
- myChart = echarts.init(document.getElementById('main' + sort));
- }
- // 指定图表的配置项和数据
- var option = {
- title: {
- text: text,
- subtext:res.otherObj,
- subtextStyle:{
- color:"#ff0000",
- fontSize: 12,
- }
- },
- grid: {
- containLabel: true,
- },
- tooltip: {trigger: 'axis'},
- legend: {
- show: true,
- right: 20,
- data: ['供给', '需求', '经纪人']
- },
- toolbox: {
- feature: {
- myTool1: {
- show: $scope.data.isShowEdit,
- // show:true,
- title: '编辑',
- icon: 'image://img/bianji.png',
- onclick: function (){
- $scope.go("Statisticseditor",{mapList : res.data,datalist:$scope.datalist})
- }
- },
- }
- },
- calculable: true,
- xAxis: {
- type: 'category',
- data: $scope.xAxisData1,
- axisLabel:{
- interval:0,//横轴信息全部显示
- rotate:-70,//-15度角倾斜显示
- }
- },
- yAxis: {
- type: 'value',
- textStyle: {
- fontSize: 14,
- color: '#686666',
- fontWeight: 'normal',
- }
- },
- series: [{
- name: '需求',
- type: 'bar',
- color: '#CC0066',
- data: $scope.demandCategortList,
- label: {
- show: "true",
- position: "top",
- fontWeight: "bolder",
- color: '#c23531',
- fontSize: "14"
- }
- },
- {
- name: '供给',
- type: 'bar',
- color: '#009999',
- data: $scope.supplyCategortList,
- label: {
- show: "true",
- position: "top",
- fontWeight: "bolder",
- color: '#c23531',
- fontSize: "14"
- }
- },
- {
- name: '经纪人',
- type: 'bar',
- color: '#FFCC33',
- data: $scope.brokerCategortList,
- label: {
- show: "true",
- position: "top",
- fontWeight: "bolder",
- color: '#c23531',
- fontSize: "14"
- }
- }]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- }
- })
- }
- })
- }
- //获取科技成果转化的数量
- var getBarChartForAchieveTrans = function (restype, text) {
- dataToolsService.getBarChartForAchieveTrans($scope.fatherindexname, restype).then(function (res) {
- if (res.code == 3350) {
- // console.log(res)
- $scope.achieveTransDataList = res.data;
- angular.forEach($scope.achieveTransDataList, function (res) {
- if (res.type == "需求提出率") {
- $scope.demandRate = res.num;
- }
- })
- $scope.xAxisData = ['人才', '技术', '高校'];
- //绘图部分
- var myChart = null;
- if ($scope.isapp) {
- myChart = echarts.init(document.getElementById('main121'));
- } else {
- myChart = echarts.init(document.getElementById('main21'));
- }
- // 指定图表的配置项和数据
- var option = {
- title: {
- text: text,
- subtext:res.otherObj,
- subtextStyle:{
- color:"#ff0000",
- fontSize: 12,
- }
- },
- grid: {
- containLabel: true,
- },
- tooltip: {trigger: 'axis'},
- legend: {
- show: true,
- right: 20,
- data: ['需求', '供给', '转化']
- },
- toolbox: {
- feature: {
- myTool1: {
- show: $scope.data.isShowEdit,
- // show:true,
- title: '编辑',
- icon: 'image://img/bianji.png',
- onclick: function (){
- $scope.go("Statisticseditor",{mapList : res.data,datalist:$scope.datalist})
- }
- },
- }
- },
- calculable: true,
- xAxis: {
- type: 'category',
- data: $scope.xAxisData,
- axisLabel:{
- interval:0,//横轴信息全部显示
- rotate:-15,//-15度角倾斜显示
- }
- },
- yAxis: {
- type: 'value',
- textStyle: {
- fontSize: 14,
- color: '#686666',
- fontWeight: 'normal',
- }
- },
- series: [{
- name: '需求',
- type: 'bar',
- color: '#CC0066',
- data: [$scope.achieveTransDataList[6].num, $scope.achieveTransDataList[7].num, 0],
- label: {
- show: "true",
- position: "top",
- fontWeight: "bolder",
- color: '#c23531',
- fontSize: "14"
- }
- },
- {
- name: '供给',
- type: 'bar',
- color: '#009999',
- data: [$scope.achieveTransDataList[2].num, $scope.achieveTransDataList[8].num, 0],
- label: {
- show: "true",
- position: "top",
- fontWeight: "bolder",
- color: '#c23531',
- fontSize: "14"
- }
- },
- {
- name: '转化',
- type: 'bar',
- color: '#FFCC33',
- data: [$scope.achieveTransDataList[10].num, $scope.achieveTransDataList[11].num, 0],
- label: {
- show: "true",
- position: "top",
- fontWeight: "bolder",
- color: '#c23531',
- fontSize: "14"
- }
- }]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
- }
- })
- }
- //其他
- // var getBarChartForOthers = function (restype, text) {
- // dataToolsService.getBarChartForOthers($scope.fatherindexname, restype).then(function (res) {
- // if (res.code == 3350) {
- // $scope.othersDataList = res.data;
- // }
- // })
- // }
- });
|