forked from p51497208/geo_info_platform
complete knowledge graph and modify the province to place
This commit is contained in:
parent
89b3bdf9cf
commit
d269d45c37
62
demo.html
62
demo.html
|
@ -69,12 +69,12 @@
|
||||||
<div class="show_detail">
|
<div class="show_detail">
|
||||||
<span class="iconfont icon-gengduo more_icon"></span>
|
<span class="iconfont icon-gengduo more_icon"></span>
|
||||||
<ul class="detail_info">
|
<ul class="detail_info">
|
||||||
<li class="info_txt" data-key="prov">省份</li>
|
<li class="info_txt" data-key="prov">地点</li>
|
||||||
<li class="info_txt" data-key="lon">经纬度</li>
|
<li class="info_txt" data-key="lon">经纬度</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-prov">
|
<div class="search-prov">
|
||||||
<input class="search_input" placeholder="请输入省份" />
|
<input class="search_input" placeholder="请输入地点" />
|
||||||
<span class="search_icon iconfont icon-search"></span>
|
<span class="search_icon iconfont icon-search"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="lat_lon_sec">
|
<div class="lat_lon_sec">
|
||||||
|
@ -1094,42 +1094,51 @@
|
||||||
"links":[]
|
"links":[]
|
||||||
}}
|
}}
|
||||||
currentGraph = {
|
currentGraph = {
|
||||||
nodes: {},
|
nodes: {},
|
||||||
links: {},
|
links: {},
|
||||||
}
|
}
|
||||||
nodeMap = {};
|
nodeMap = {};
|
||||||
category = 1
|
category = 1
|
||||||
symbolSize = 40
|
symbolSize = 40
|
||||||
init(city)
|
init(city)
|
||||||
});
|
});
|
||||||
|
|
||||||
myChart.setOption(option);
|
myChart.setOption(option);
|
||||||
|
|
||||||
function fillInfo(result) {
|
function fillInfo(result, name) {
|
||||||
// graphList = {"keyword":{
|
// graphList = {"keyword":{
|
||||||
// "nodes":[],
|
// "nodes":[],
|
||||||
// "links":[]
|
// "links":[]
|
||||||
// }}
|
// }}
|
||||||
if (graphList.keyword.nodes.length == 0) {
|
if (graphList.keyword.nodes.length == 0) {
|
||||||
formNode = {"name":result.data.entity, "category":category, "symbolSize":symbolSize}
|
formNode = {"name":name, "category":category, "symbolSize":symbolSize}
|
||||||
graphList.keyword.nodes[0]=formNode
|
graphList.keyword.nodes[0]=formNode
|
||||||
category += 1
|
category += 1
|
||||||
symbolSize -= 5
|
symbolSize -= 5
|
||||||
}
|
}
|
||||||
else if (graphList.keyword.nodes[0].name == result.data.entity) {
|
else if (graphList.keyword.nodes[0].name == name) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// console.log(name)
|
||||||
|
category = nodeMap[name].category + 1
|
||||||
|
symbolSize = nodeMap[name].symbolSize - 5
|
||||||
|
}
|
||||||
|
|
||||||
nodeLen = graphList.keyword.nodes.length
|
nodeLen = graphList.keyword.nodes.length
|
||||||
linkLen = graphList.keyword.links.length
|
linkLen = graphList.keyword.links.length
|
||||||
source = result.data.entity
|
source = name
|
||||||
// console.log(result)
|
|
||||||
for (i = 0; i < result.data.avp.length; i++) {
|
for (i = 0; i < result.data.avp.length; i++) {
|
||||||
|
if (source == result.data.avp[i][1]) {
|
||||||
|
nodeLen--
|
||||||
|
linkLen--
|
||||||
|
continue
|
||||||
|
}
|
||||||
formNode = {"name":result.data.avp[i][1], "category":category, "symbolSize":symbolSize}
|
formNode = {"name":result.data.avp[i][1], "category":category, "symbolSize":symbolSize}
|
||||||
graphList.keyword.nodes[nodeLen+i]=formNode
|
graphList.keyword.nodes[nodeLen+i]=formNode
|
||||||
formLink = {"source":source, "target":result.data.avp[i][1]}
|
formLink = {"source":source, "target":result.data.avp[i][1]}
|
||||||
graphList.keyword.links[linkLen+i]=formLink
|
graphList.keyword.links[linkLen+i]=formLink
|
||||||
}
|
}
|
||||||
// console.log(graphList)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1158,7 +1167,7 @@
|
||||||
alert("nothing")
|
alert("nothing")
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
fillInfo(result)
|
fillInfo(result, name)
|
||||||
nodeMap = {};
|
nodeMap = {};
|
||||||
graph = graphList.keyword
|
graph = graphList.keyword
|
||||||
for (let i = 0; i < graph.nodes.length; i++) {
|
for (let i = 0; i < graph.nodes.length; i++) {
|
||||||
|
@ -1186,7 +1195,6 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
redrawGraph();
|
redrawGraph();
|
||||||
// append(result.data.entity)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadData(name) {
|
function loadData(name) {
|
||||||
|
@ -1195,13 +1203,9 @@
|
||||||
alert("nothing")
|
alert("nothing")
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
fillInfo(result)
|
fillInfo(result, name)
|
||||||
// nodeMap = {};
|
nodeMap = {};
|
||||||
graph = graphList.keyword
|
graph = graphList.keyword
|
||||||
// console.log("qiubing2")
|
|
||||||
console.log(graph)
|
|
||||||
// console.log(nodeMap)
|
|
||||||
len = nodeMap.length
|
|
||||||
for (let i = 0; i < graph.nodes.length; i++) {
|
for (let i = 0; i < graph.nodes.length; i++) {
|
||||||
nodeMap[graph.nodes[i].name] = graph.nodes[i];
|
nodeMap[graph.nodes[i].name] = graph.nodes[i];
|
||||||
nodeMap[graph.nodes[i].name]['links'] = {};
|
nodeMap[graph.nodes[i].name]['links'] = {};
|
||||||
|
@ -1232,10 +1236,6 @@
|
||||||
|
|
||||||
let node = nodeMap[nodeName];
|
let node = nodeMap[nodeName];
|
||||||
|
|
||||||
// console.log(node)
|
|
||||||
// console.log("qiubing3")
|
|
||||||
// console.log(nodeName)
|
|
||||||
// console.log(nodeMap)
|
|
||||||
if (node.hasAppend === true || Object.keys(node.nodes).length === 0 || Object.keys(node.links).length === 0) {
|
if (node.hasAppend === true || Object.keys(node.nodes).length === 0 || Object.keys(node.links).length === 0) {
|
||||||
alert("无法继续展开");
|
alert("无法继续展开");
|
||||||
return
|
return
|
||||||
|
@ -1269,10 +1269,8 @@
|
||||||
}
|
}
|
||||||
// 根据更新后的option重新画图
|
// 根据更新后的option重新画图
|
||||||
function redrawGraph() {
|
function redrawGraph() {
|
||||||
// console.log(currentGraph)
|
|
||||||
optionGraph.series[0].data = Object.values(currentGraph.nodes);
|
optionGraph.series[0].data = Object.values(currentGraph.nodes);
|
||||||
optionGraph.series[0].links = Object.values(currentGraph.links);
|
optionGraph.series[0].links = Object.values(currentGraph.links);
|
||||||
// console.log(optionGraph);
|
|
||||||
myChartGraph.setOption(optionGraph);
|
myChartGraph.setOption(optionGraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1315,14 +1313,14 @@
|
||||||
{
|
{
|
||||||
name: 4,
|
name: 4,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#61a0a8'
|
color: '#999ea4'
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 5,
|
name: 5,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#999ea4'
|
color: '#555555'
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -1363,10 +1361,6 @@
|
||||||
if (node.hasAppend === true) {
|
if (node.hasAppend === true) {
|
||||||
remove(node.name)
|
remove(node.name)
|
||||||
} else {
|
} else {
|
||||||
// console.log("qiubing")
|
|
||||||
// console.log(node)
|
|
||||||
// console.log(nodeMap)
|
|
||||||
// console.log(node.name)
|
|
||||||
loadData(node.name);
|
loadData(node.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue