码迷,mamicode.com
首页 > 其他好文 > 详细

每周总结

时间:2020-04-12 22:51:55      阅读:80      评论:0      收藏:0      [点我收藏+]

标签:pat   option   bottom   json   file   page   contex   mouse   fun   

本周继续学习了echarts的异步加载方式:

<%@ include file="left.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html style="height: 100%">
<head>
<meta charset="UTF-8">
<title>京津冀</title>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/dist/extension/dataTool.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts/map/js/china.js"></script>
<script type="text/javascript" src="js/jquery-3.3.1.js"></script>
</head>
<body style="height: 100%; margin: 0">
    <div id=container style="height:100% ;left:100px;top:0px" ></div>
    <script type="text/javascript">

//$.get(‘flare.json‘, function (data) {
     $(function() {
            $.get(${pageContext.request.contextPath}/servlet?method=search,
                    function(data) {
                       // alert("123")
                        init(data);
                       // alert("1234")
                        //alert(data);
                    });
        }); 
         function init(data) {
                //alert(data)
                var data=data;
                
                var dom = document.getElementById("container");
                var myChart = echarts.init(dom);
                var app = {};
                option = null;
                myChart.showLoading();
                myChart.hideLoading();

    myChart.setOption(option = {
            tooltip: {
                trigger: item,
                triggerOn: mousemove
            },
            series: [
                {
                    type: tree,

                    data: [data],

                    top: 1%,
                    left: 7%,
                    bottom: 1%,
                    right: 20%,

                    symbolSize: 7,

                    label: {
                        position: left,
                        verticalAlign: middle,
                        align: right,
                        fontSize: 9
                    },

                    leaves: {
                        label: {
                            position: right,
                            verticalAlign: middle,
                            align: left
                        }
                    },

                    expandAndCollapse: true,
                    animationDuration: 550,
                    animationDurationUpdate: 750
                }
            ]
        });
    

if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
}
       </script>
</body>
</html>

 

技术图片

每周总结

标签:pat   option   bottom   json   file   page   contex   mouse   fun   

原文地址:https://www.cnblogs.com/kt-xb/p/12687804.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!