可视化工具分享
2016-06-01 16:19
501 查看
Flask
简介
Flask是一个使用 Python 编写的轻量级 web 应用框架简单易用,上手快
安装使用
pip install flask一个具体应用
结构cloud/
static/
templates/
a.py
a.py解析
#!/usr/bin/env python #encoding:utf-8 import sys import time import datetime from flask import Flask,render_template,request,Markup reload(sys) sys.setdefaultencoding('utf8') app=Flask(__name__) def fun(position): f = open(position,"r") data = [] for line in f: line = line.strip() li = line.split("|") if li[0]=='part' or li[0]=='plan': s = li[1]+":"+li[2] data.append(s) f.close() return data @app.route("/C/<i>") def indexC(i): dt = str(i) position = '/home/auto/'+dt+'_c_tag/'+'000000_0' data_C = fun(position) return render_template('cloud_C.html',data = data_C) @app.route("/G/<i>") def indexG(i): dt = str(i) position = '/home/auto/'+dt+'_g_tag/'+'000000_0' data_G = fun(position) return render_template('cloud_G.html',data = data_G) if __name__=="__main__": app.run(host='0.0.0.0',debug=True)
源数据格式
项目 | 关键词 | 人数 | 时间 | 项目标记 |
---|---|---|---|---|
part | 鼻翼缩小 | 1111 | 20160410 | wzx |
plan | V脸 | 115 | 20160410 | wzx |
plan | botox | 265 | 20160410 | wzx |
plan | 下颌角磨削术 | 196 | 20160410 | wzx |
plan | 中胚层疗法 | 10 | 20160410 | wzx |
关键词 | 人数 |
---|---|
鼻翼缩小 | 1111 |
V脸 | 115 |
… | … |
{"name": "微整形数据", "children": [{"name": "C", "children": [{"name": "atte", "children": [{"name": "1:1683"}, {"name": "2:228"}, {"name": "3:92"}, {"name": "4:51"}, {"name": "5:197"}]}, {"name": "part", "children": [{"name": "下巴:2552"}, {"name": "双眼皮:22552"}, {"name": "嘴部:982"}, {"name": "开眼角:2989"}, {"name": "毛发:2224"}, {"name": "泪沟:181"}....
Echart
一个词云的例子
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>微整形C网关键词热度预览</title> </head> <body> <!-- 为ECharts准备一个具备大小(宽高)的Dom --> <div id="main" style="height:400px"></div> <!-- ECharts单文件引入 --> <script src="http://echarts.baidu.com/build/dist/echarts.js"></script> <script type="text/javascript"> // 路径配置 require.config({ paths: { echarts: 'http://echarts.baidu.com/build/dist' } }); // 使用 require( [ 'echarts', 'echarts/chart/wordCloud' // 使用什么图就对照官网加载什么模块,按需加载 ], function (ec) { // 基于准备好的dom,初始化echarts图表 var myChart = ec.init(document.getElementById('main')); function createRandomItemStyle() { return { normal: { color: 'rgb(' + [ Math.round(Math.random() * 160), Math.round(Math.random() * 160), Math.round(Math.random() * 160) ].join(',') + ')' } }; } var option = { title: { text: '微整形C网关键词热度预览', link: '' }, tooltip: { show: true }, series: [{ name: '详情', type: 'wordCloud', size: ['49%', '95%'], textRotation : [0, 0, 0, 0], textPadding: 0, autoSize: { enable: true, minSize: 18 }, data: [ {% for item in data %} { name:"{{item}}".split(":")[0], value:"{{item}}".split(":")[1], itemStyle: createRandomItemStyle() }, {% endfor %} ] }] }; // 为echarts对象加载数据 myChart.setOption(option); } ); </script> </body>
ElasticSearch
简介
Lucene基于java,是一个库,需要在程序中引用,逻辑复杂分布式、实时、易扩展的全文搜索引擎,基于 Lucene
简单易用,上手快
安装启动
javawget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.4.tar.gz
tar -xvfelasticsearch-1.3.4.tar.gz
cd elasticsearch-1.3.4
安装服务 elasticsearch start/stop
安装监控marvel,就可以在网页上实现与集群的交互
http://192.168.52.129:9200/?pretty
http://192.168.52.129:9200/_plugin/marvel/sense/
重要概念
集群节点
分片和复制
索引,类型,文档,域
使用
可以直接将语句写进sh文件执行,也可以直接在命令行执行,查询语句是DSL语言,json格式检查集群健康 curl ‘localhost:9200/_cat/health?v’
epoch | timestamp | cluster | status | node.total | node.data | shards | pri | relo | init | unassign |
---|---|---|---|---|---|---|---|---|---|---|
1464822255 | 07:04:15 | zl-es | green | 2 | 2 | 54 | 27 | 0 | 0 | 0 |
查看所有索引列表 curl ‘localhost:9200/_cat/indices?v’
health | index | pri | rep | docs.count | docs.deleted | store.size | pri.store.size |
---|---|---|---|---|---|---|---|
green | marvel-2016.06.01 | 1 | 1 | 30227 | 0 | 68.4mb | 35.1mb |
green | bank1 | 5 | 1 | 1000 | 0 | 842.3kb | 423.6kb |
green | bank | 5 | 1 | 1000 | 0 | 837.2kb | 418.6kb |
green | customer | 5 | 1 | 3 | 0 | 16kb | 8kb |
更新update,删除delete,聚合操作,过滤查询……
DSL查询特点 curl -
<REST Verb>
<Node>:
<Port>/
<Index>/
<Type><ID>
更新一个字段的值
curl -XPUT 'localhost:9200/customer/external/1?pretty' -d ' { "name": "Jane Doe" }'
删除一个文档
curl -XDELETE 'localhost:9200/customer/external/_query?pretty' -d ' { "query": { "match": { "name": "John" } } }'
返回地址中包含“mill”或者包含“lane”的账户
curl -XPOST 'localhost:9200/bank/_search?pretty' -d ' { "query": { "match": { "address": "mill lane" } } }'
相关文章推荐
- 【js框架】随笔
- C语言练习篇-3控制语句练习,闰年
- java集合类说明与区别
- LeetCode:Binary Search Tree Iterator
- Java4Android第11课:内部类和匿名内部类
- Android Application的理解和使用
- 状态栏字体颜色控制
- windows下 PyCharm安装scrapy
- Java Collections Framework Java集合框架概览
- 4.1.按键--按下按键使LED点亮
- 《图解TCP/IP》读书笔记(5)
- ie下不打开控制台js无法执行
- 初识java.util.concurrent.CountDownLatch
- 欢迎使用CSDN-markdown编辑器
- 数据结构_P10
- 12 打印1到最大的N位数(递归和非递归解法)
- Swift开篇009->方法
- 删除字符串中的指定字符(23)
- 在jdbc中使用properites文件进行使用
- Oracle数据库DOC命令导入导出(2014-3-10记)