让人个人

来源:互联网 发布:php魔术方法isset() 编辑:程序博客网 时间:2024/05/16 03:05
<script type="text/javascript">        // 基于准备好的dom,初始化echarts实例        var myChart = echarts.init(document.getElementById('main'));        // 加载同目录下json文件中的json数据        $.getJSON("data.json", function(linedata) {    var option = {        //设置整个页面的背景颜色        backgroundColor: new echarts.graphic.RadialGradient( 0.3, 0.3, 0.8,[{            offset: 0,            color: '#f7f8fa'        }, {            offset: 1,            color: '#cdd0d5'        }]),        //设置标题        title: {            text: "学者合作信息图",            top: "top",            left: "center"        },        tooltip: {},        legend: [{            formatter: function(name) {                return echarts.format.truncateText(name, 40, '14px Microsoft Yahei', '…');            },            tooltip: {                show: true            },            selectedMode: 'false',            bottom: 20,        }],        //右上角的三个工具按钮        toolbox: {            show: true,            feature: {                dataView: {                    show: true,                    readOnly: true                },                restore: {                    show: true                },                saveAsImage: {                    show: true                }            }        },        animationDuration: 3000,        animationEasingUpdate: 'quinticInOut',        //图片的形式        series: [{            name: 'scholar',            type: 'graph',            layout: 'force',            force: {                repulsion: 1000            },            //设置节点信息和边的信息            data: linedata.data,            links: linedata.links,            categories: [{                'name': '分类1'            }, {                'name': '分类2'            }, {                'name': '分类3'            }, {                'name': '分类4'            }, {                'name': '分类5'            }],            focusNodeAdjacency: true,            roam: true,            label: {                normal: {                    show: true,                    position: 'top',                }            },            //边的格式            lineStyle: {                normal: {                    opacity: 1,                    width: 1,                    curveness: 0.1                }            }        }]    };    myChart.setOption(option)    myChart.on('dblclick', function (params) {    window.open('https://www.baidu.com/s?wd=' + encodeURIComponent(params.name));});myChart.on('click', function (params) {$.getJSON("detail.json", function(detail){if (params.name in detail) {var name = document.getElementById("name");var head = document.getElementById("header");var sex = document.getElementById("sex");var bachelor_uni = document.getElementById("bachelor_uni");var bachelor_uni1 = document.getElementById("bachelor_uni1");var doctor_uni = document.getElementById("doctor_uni");var doctor_uni1 = document.getElementById("doctor_uni1");var master_uni = document.getElementById("master_uni");var master_uni1 = document.getElementById("master_uni1");var research_direction = document.getElementById("research_direction");var research_direction1 = document.getElementById("research_direction1");var tutor = document.getElementById("tutor");var tutor1 = document.getElementById("tutor1");//更新文本框中对应学者的信息name.innerHTML = "name: "+params.name;head.innerHTML = "Detail";sex.innerHTML = "sex: " + detail[params.name].sex;bachelor_uni1.innerHTML = "bachelor_uni: "bachelor_uni.innerHTML = detail[params.name].bachelor_uni;doctor_uni1.innerHTML = "doctor_uni: "doctor_uni.innerHTML = detail[params.name].doctor_uni;master_uni1.innerHTML = "master_uni: "master_uni.innerHTML = detail[params.name].master_uni;research_direction1.innerHTML = "research_direction: "research_direction.innerHTML = detail[params.name].research_direction;tutor1.innerHTML = "tutor: "tutor.innerHTML = detail[params.name].tutor;}});    });})    </script>

原创粉丝点击