百度echarts tree 节点点击事件
2018年12月10日话不多说直接源码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
$(document).ready(function() { var myChart = echarts.init(document.getElementById('jsmind_container')) myChart.on("click", clickMethod); //绑定点击方法 var data = { "name": "开始分析", "symbol":"image://http://192.168.1.216/img/charts/start.png", 'symbolSize': 64, "children": [ { "name": "AutoPico.exe", "symbol":"image://http://192.168.1.216/img/charts/exe.png", 'symbolSize': 64, "children": [ { "name": "regedit.exe", "symbol": "image://http://192.168.1.216/img/charts/exe.png", }, { "name": "AutoPico.log", "symbol": "image://http://192.168.1.216/img/charts/out.png", }, { "name": "2.pool.ntp.org", "symbol": "image://http://192.168.1.216/img/charts/exe.png", } ] } ], }; myChart.showLoading(); myChart.hideLoading(); myChart.setOption(option = { tooltip: { trigger: 'item', }, series: { type : 'tree', name : 'tree', data : [data], top : '20%', left : '20%', bottom : '22%', right : '18%', symbolSize : 32, roam : true, label : { normal: { position: 'left', verticalAlign: 'middle', align: 'right' } }, leaves: { label: { normal: { position: 'right', verticalAlign: 'middle', align: 'left' } } }, expandAndCollapse : true, animationDuration : 550, animationDurationUpdate : 750 } }); //具体的事件 function clickMethod(param) { if (typeof param.seriesIndex == 'undefined') { return; } if (param.type == 'click') { layer.open({ type : 2, title : param.name, area : ['800px', '300px'], shadeClose : true, shade : false, maxmin : false, //开启最大化最小化按钮 content : '/presentation_detailProcess?id='+{{$dsUploadFile->id}}+' &processID='+param.name+' &processName='+param.name }) } } }); |