• 周总结6


    这周任务:顶会热词统计

    <%@page import="java.util.Iterator"%>
    <%@page import="java.util.HashMap"%>
    <%@page import="entity.Cvf"%>
    <%@page import="java.util.List"%>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>CVPR词云</title>
        <script type="text/javascript" src="Echart/echarts.js"></script>
        <script type="text/javascript" src="Echart/echarts-wordcloud.min.js"></script>
    
    </head>
    <body>
    <%         request.setCharacterEncoding("utf-8");
    List <Cvf> cvfs =(List<Cvf>) request.getAttribute("cvfs"); 
    int i=0;
    int j=0;
    int k=0;
    HashMap<String, Integer> hm=new HashMap();
    if(cvfs!=null){
            for(Cvf cvf:cvfs){i++;
            if (!hm.containsKey(cvf.getCkeyword())) {
                hm.put(cvf.getCkeyword(), 1);                
            }else {
                Integer counts=hm.get(cvf.getCkeyword());
                hm.put(cvf.getCkeyword(), counts+1);        
            }
    
            }
    }
    %>
    <div id="main" style=" 800px; height: 600px"></div>
        <script>
                var myChart = echarts.init(document.getElementById('main'));
                option = {
                        title: {
                            text: '词云',//标题
                            x: 'center',
                            textStyle: {
                                fontSize: 23
                            }
    
                        },
                        backgroundColor: '#F7F7F7',
                        tooltip: {
                            show: true
                        },
                        series: [{
                            name: '热点分析',//数据提示窗标题
                            type: 'wordCloud',
                            sizeRange: [6, 66],//画布范围,如果设置太大会出现少词(溢出屏幕)
                            rotationRange: [-45, 90],//数据翻转范围
                            //shape: 'circle',
                            textPadding: 0,
                            autoSize: {
                                enable: true,
                                minSize: 6
                            },
                            drawOutOfBound: true,//词云显示完整,超出画布的也显示
                            textStyle: {
                                normal: {
                                    color: function() {
                                        return 'rgb(' + [
                                            Math.round(Math.random() * 160),
                                            Math.round(Math.random() * 160),
                                            Math.round(Math.random() * 160)
                                        ].join(',') + ')';
                                    }
                                },
                                emphasis: {
                                    shadowBlur: 10,
                                    shadowColor: '#333'
                                }
                            },
                            data:[
                                <%
                                 //获取request域中的数据
                                      Iterator<String> it=hm.keySet().iterator();
                                      while(it.hasNext()) {
                                          String keyName=it.next();
    
                             %>
                             {name:"<%=keyName%>",value:<%=hm.get(keyName) %>},
                             <%
                             
                                 }
                             %>
                            ]
                        }]
                      };
    
            myChart.setOption(option,true);
            myChart.on('click',function(param){
                var selected = param.name;
                if(selected){              
                window.open("ListServlet?keyword="+selected);
                }
    
                });
        </script>
    </body>
    </html>
    View Code
    <%@page import="entity.Cvf"%>
    <%@page import="java.util.List"%>
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>链接地址</title>
    </head>
    <body>
    <%         request.setCharacterEncoding("utf-8");
    List <Cvf> cvfs =(List<Cvf>) request.getAttribute("cvfs"); 
    %>
    
          <table >
          <thead >
             <tr>
             <th>标题</th>
             <th>关键词</th>
             </tr>
          </thead>
          <tbody class="htbody">
             <%
    
             if(cvfs!=null){
               for(Cvf cvf:cvfs){
                   %>               
                   <tr>                   
                       <td><a href="<%=cvf.getChref() %>"><%=cvf.getCname() %></a></td>
                       <td><%=cvf.getCkeyword() %></td>
                   </tr>
                   <%
               }
             }
             %>
             </tbody>
          </table> 
    </div>
    </body>
    </html>
    View Code
  • 相关阅读:
    safeNet
    网店
    微信公众号自定义菜单与回车
    西游记对教育的启发
    zencart资源
    cmd批处理常用符号详解
    div垂直居中
    git工作量统计
    VS2012变化的快捷键:
    sql 树 递归
  • 原文地址:https://www.cnblogs.com/vvxvv/p/12733705.html
Copyright © 2020-2023  润新知