hostTopo.jsp 4 KB
<%@page language="java" contentType="text/html;charset=utf-8" %>
<%@ page import="com.ui.contants.ProjectConstant"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <jsp:include page="/jsp/common/include.jsp" flush="true"/>
    <script>
        var contextPath = '<%=basePath %>';
    </script>
    <title>YOHO!运维</title>
</head>
<body>

<!-- 头部 -->
<div id="head">
</div>
<!-- 右侧具体内容 -->
<div id="content">
    <div id="breadcrumb">
        <a href="#" title="Go to Home" class="tip-bottom"><i
            class="icon-home"></i> Home</a> <a href="#" class="current">主机拓扑图</a>
    </div>
    <div class="container-fluid">
        <div class="widget-box">
            <div class="widget-title">
                <h5>主机管理-主机拓扑图</h5>
            </div>
            <div class="widget-content nopadding">
                <div id="hostTopoDiv" class="input-group"
                     style="height: 600px;width: 1000px;margin-left: 50px">
                </div>

            </div>
        </div>
    </div>
</div>
</body>
<script src="<%=basePath %>script/common/genarate_left_panel.js?v=<%=ProjectConstant.MENU_VERSION %>"></script>
<script>
    $("#li_host").addClass("active open");
    $("#li_hostTopo").addClass("active");
</script>
<script>
    var theme = {
        // 默认色板
        color: [
            '#68a54a',
            '#408829',
            '#a9cba2',
            '#86b379',

            '#397b29',
            '#8abb6f',
            '#759c6a',
            '#bfd3b7'
        ]};

    var dataOptionList=${echartDataList};

    var option = {
        title: {
            text: '主机topo-'+"前台"
        },

        tooltip: {
            show:false,
            //trigger:'item',
            //enterable:true,
            formatter:function(){
                return "b<br/>a : c分<input type='checkbox'/>";
            }
        },
        animationDurationUpdate: 1500,
        animationEasingUpdate: 'quinticInOut',
        series : [
            {
                silent:false,//图形是否不响应和触发鼠标事件
                legendHoverLink:false,
                hoverAnimation:false,
                focusNodeAdjacency:false,
                //left:0,
                top:50,
                type: 'graph',
                layout: 'none',
                symbolSize:50,
                label: {
                    normal: {
                        show: true
                    }
                },

                symbol:'roundRect',
                edgeSymbol: ['roundRect', 'arrow'],
                edgeSymbolSize: [4, 10],
                edgeLabel: {
                    normal: {
                        textStyle: {
                            fontSize: 20
                        }
                    }
                },
//data:d1,
                data:dataOptionList,
                links: [],
                lineStyle: {
                    normal: {
                        opacity: 0.9,
                        width: 2
                    }
                }
            }
        ]
    };

    // 基于准备好的dom,初始化echarts实例
   var myChart = echarts.init(document.getElementById('hostTopoDiv'),theme);

  //  var myChart = echarts.init(document.getElementById('hostTopoDiv'));
    $(function () {
        //更新曲线图
        myChart.setOption(option);

        myChart.on("click", function (param){
            alert(param.dataIndex+':'+option.series[0].data[param.dataIndex].name+":"+option.series[0].data[param.dataIndex].itemStyle.normal.color);
           option.series[0].data[param.dataIndex].itemStyle.normal['color']="#ff5e52";

           myChart.setOption(option,true);//重绘
        });
    });


</script>