本周进行了企业知识图谱
投资人方面的展示的编写
<%@ page language='java' contentType='text/html; charset=UTF-8' pageEncoding='UTF-8'%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'> <title>企业投资族谱</title> <!-- Bootstrap --> <link href='${pageContext.request.contextPath}/plug-ins/css/bootstrap.css' rel='stylesheet'> <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery,所以必须放在前边) --> <script src='${pageContext.request.contextPath}/plug-ins/js/jquery-1.10.2.min.js'></script> <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 --> <script src='${pageContext.request.contextPath}/plug-ins/js/bootstrap.js'></script> <link rel='stylesheet' type='text/css' href='${pageContext.request.contextPath}/plug-ins/jquery/jquery-ui.css'> <script src='${pageContext.request.contextPath}/plug-ins/jquery/jquery-1.12.1.js'></script> <script src='${pageContext.request.contextPath}/plug-ins/jquery/jquery-ui.js'></script> <link href='${pageContext.request.contextPath}/main.css' rel='stylesheet'> <script src='${pageContext.request.contextPath}/plug-ins/echarts/echarts.js'></script> <script type='text/javascript'> $(function() { var data = ''; $.ajax({ async : true, url : '${pageContext.request.contextPath}/dataProjectServlet', data : { method : 'getCropBeans', }, success : function(res) { data = res; addCorpName(data); }, dataType : 'json' }); }); function addCorpName(data) { var availableTags = new Array(); for (var i = 0; i < data.length; i++) { availableTags[i] = data[i].CORP_NAME; } $('#tags').autocomplete({ source : availableTags }); } function getBaseInfo() { var Name = $('#tags').val(); if(Name!=''){ $.ajax({ async:true, url : '${pageContext.request.contextPath}/dataProjectServlet', data:{ method:'isAlive', name:Name }, success:function(data){ var isAlive = data; if(isAlive){ window.location.href='${pageContext.request.contextPath}/dataProjectServlet?method=getBaseInfo&name='+Name; }else{ alert('没有该公司!!! 请重新输入'); } }, dataType:'json' }); } } </script> <style type='text/css'> .ui-widget-content { /* padding-top: 20px; */ border-radius: 15px; } .content { width: 100%; background-color: white; border-radius: 2.5em; height:95%; } #content{ width: 100%; height: 85%; float: left; } </style> </head> <body> <div class='app-container app-theme-white body-tabs-shadow fixed-sidebar fixed-header' > <div class='app-main'> <div class='app-main__outer' style="margin:0px;"> <div class='app-main__inner'> <div class='content' > <div id='content'> </div> </div> </div> </div> </div> </div> <script type='text/javascript' src='${pageContext.request.contextPath}/assets/scripts/main.js'></script> </body> <script type='text/javascript'> $(function(){ var dom = document.getElementById('content'); var myChart = echarts.init(dom); myChart.showLoading(); var cname= '${data.CORP_NAME}'; //获取投资人信息 var peo = ""; $.ajax({ async:true, url:"${pageContext.request.contextPath}/dataProjectServlet", data:{ method:'getCropstock', name:cname }, success:function(res){ // peo = res; if(res==null){ peo=""; }else{ for(var i=0;i<res.length;i++){ peo +='{"name":"'+res[i].STOCK_NAME+' '+res[i].STOCK_PERCENT+'","itemStyle":{"color" : "#7985f2","borderColor":"#7985f2"}},'; } } // console.log(peo); // alert(peo); getCropdists(cname,peo,myChart); }, dataType:'json' }); // myChart.setOption(option, true); }); function getCropdists(cname,peo,myChart) { //获取分公司信息 var company = ""; $.ajax({ async:true, url:'${pageContext.request.contextPath}/dataProjectServlet', data:{ method:'getCropdists', name:cname }, success:function(res){ // company = res; // alert(company); if(res==null){ company=""; }else{ for(var i=0;i<res.length;i++){ company+='{"name":"'+res[i].DIST_NAME+' '+res[i].OPER_MAN_NAME+'","itemStyle":{"color" : "#7985f2","borderColor":"#7985f2"}},'; } } // alert(peo); console.log(company); paint(myChart,peo,company); // myChart.showLoading(); }, dataType:"json" }); } function paint(myChart,peo,company) { if(company!=""){ company = company.substring(0,company.length-1); company = "["+company+"]" var companys = JSON.parse(company); }else{ var companys = []; } if(peo!=""){ peo = peo.substring(0,peo.length-1); peo = "["+peo+"]"; var peos = JSON.parse(peo); // var peos = [peo]; }else{ var peos = []; } var data= { 'name':'发起者', 'itemStyle': { 'color' : '#3ca6ff', 'borderColor':'#3ca6ff' }, 'children': [ { 'name':'股东发起人', 'itemStyle': { 'color' : '#7985f2', 'borderColor':'#7985f2' }, 'children':peos, }, { 'name':'对外投资', 'itemStyle': { 'color' : '#7985f2', 'borderColor':'#7985f2' }, 'children':companys } ] }; // alert(typeof(data)); myChart.setOption(option = { tooltip: { trigger: 'item', triggerOn: 'mousemove', confine:false }, series: [ { type: 'tree', data: [data], /* itemStyle: { normal: { borderWidth: 1, borderColor: '#aaa' } },*/ lineStyle: { normal: { position: 'left', verticalAlign: 'middle', align: 'right', color: '#78a3f2', curveness: 0.8 } }, padding: [ 5, // 上 10, // 右 5, // 下 10, // 左 ], position: ['50%', '50%'], symbolSize: 15, label: { normal: { position: 'left', verticalAlign: 'middle', align: 'right', fontSize:20 } }, leaves: { label: { normal: { position: 'left', verticalAlign: 'middle', align: 'right', fontSize:16 } } }, // layout: 'radial', // symbol: 'emptyCircle', expandAndCollapse: true, animationDuration: 550, animationDurationUpdate: 750, } ] }); // myCharts.resize(); myChart.hideLoading(); // window.addEventListener("resize", function () { //myCharts是你的初始化echarts图表时取的名字 // }); } </script> </html>