1. 第一章 概述
寄云可视化系统作为一个数据探查和可视化平台,该工具在可视化,易用性和交互性方面非常有特色,用户可以轻松的对数据进行可视化分析,简化用户的数据探索和分析操作流程。 主要特性: 1、快速创建可视化互动仪表盘; 2、丰富的可视化图表模板,灵活可扩展; 3、可以灵活控制数据在UI上的展现方式; 4、兼顾数据的可扩展性,细粒度,复杂规则查询等。
2. 第二章 订阅可视化
1.参考寄云应用开发与数据分析平台使用手册完成可视化服务的订阅,订阅过程中,输入可视化服务的用户名,密码。
2.可视化服务详情
订阅完成后,在服务详情页面将给出如下服务参数:
用户名 | kshdemo |
---|---|
密码 | Admin123456 |
3.可视化服务使用
创建好的可视化点击“管理服务”即可通过网页浏览器方式访问。 默认的访问地址是: http://vis.neuseer.com/dashboard/all
首先见到的是登陆页面,登录的用户名,密码为创建可视化服务基本信息中的用户名和密码如:
登录后页面如下,显示“我的图表”“我的仪表盘”“我的数据集”“基础数据配置”
可视化是对数据分析结果的展示服务,数据分析操作或过程需要使用spark服务完成,在数据分析处理的代码中调用专门的可视化方法将结果在展示服务中生成对应的结果图表,用户需要根据用户手册中spark使用说明创建Spark服务,创建完成在后点管理服务打开,默认地址:https://spark.neuseer.com:9995/#/,然后点“Create new note”这里创建了一个名为test的note。
打开test,输入示例代码:
import cn.neucloud.dasuan.analysis.spath.SPathDistribute
import cn.neucloud.dasuan.analysis.spath.nfa.SelectionPolicy
import cn.neucloud.dasuan.analysis.spath.nfa.NFA
import org.apache.spark.sql.SQLContext
import org.apache.spark.sql.DataFrame
import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.rdd.RDD
import org.apache.spark.rdd.PairRDDFunctions
import cn.neucloud.dasuan.analysis.spath.parser.PartitionParser
import net.sf.json.JSONArray
import net.sf.json.JSONObject
import org.apache.log4j.{Level, Logger}
import cn.neucloud.viz.analysis.Visualize
import cn.neucloud.bigdata.taskserver.bean.viz.algtype.AlgorithmTypes
import cn.neucloud.bigdata.taskserver.bean.viz.config._
import cn.neucloud.bigdata.taskserver.bean.viz.viztype._
import cn.neucloud.dasuan.analysis.spath.sankey.{SPathGraphGenOnline, SPathVizConfig}
import cn.neucloud.dasuan.analysis.timeseries.Sessionize
import org.apache.spark.sql.{DataFrame, Row, SQLContext}
import org.apache.spark.sql.functions._
import org.apache.spark.sql.types.{StructField, _}
val json = Seq[String](
"{'sessionid':'100001','timeid':0,'pagetype':'home','pageid':100,'productprice':100,'productname':'category\_0'}", "{'sessionid':'100001','timeid':1,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food1\_1'}", "{'sessionid':'100001','timeid':2,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food1\_2'}", "{'sessionid':'100001','timeid':3,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food1\_3'}", "{'sessionid':'100001','timeid':4,'pagetype':'home','pageid':100,'productprice':100,'productname':'category\_4'}", "{'sessionid':'100001','timeid':5,'pagetype':'submit','pageid':100,'productprice':999.99,'productname':'system\_5'}", "{'sessionid':'100001','timeid':6,'pagetype':'thankyou','pageid':100,'productprice':999.99,'productname':'system\_6'}", "{'sessionid':'100001','timeid':7,'pagetype':'checkout','pageid':100,'productprice':999.99,'productname':'system\_7'}", "{'sessionid':'100001','timeid':8,'pagetype':'thankyou','pageid':100,'productprice':999.99,'productname':'system\_8'}", "{'sessionid':'100001','timeid':9,'pagetype':'checkout','pageid':100,'productprice':89.99,'productname':'system\_9'}", "{'sessionid':'100001','timeid':10,'pagetype':'thankyou','pageid':100,'productprice':10,'productname':'system\_10'}", "{'sessionid':'100001','timeid':11,'pagetype':'home','pageid':100,'productprice':100,'productname':'category\_11'}", "{'sessionid':'100001','timeid':12,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food2\_12'}", "{'sessionid':'100001','timeid':13,'pagetype':'home','pageid':100,'productprice':100,'productname':'category\_13'}", "{'sessionid':'100001','timeid':14,'pagetype':'checkout','pageid':100,'productprice':999.99,'productname':'system\_14'}", "{'sessionid':'100001','timeid':15,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food2\_15'}", "{'sessionid':'100001','timeid':16,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food2\_16'}", "{'sessionid':'100001','timeid':17,'pagetype':'productview','pageid':100,'productprice':1500.32,'productname':'food2\_17'}", "{'sessionid':'100001','timeid':18,'pagetype':'submit1','pageid':100,'productprice':100,'productname':'system\_18'}", "{'sessionid':'100001','timeid':19,'pagetype':'submit2','pageid':100,'productprice':100,'productname':'system\_19'}", "{'sessionid':'100001','timeid':20,'pagetype':'checkout','pageid':100,'productprice':999.99,'productname':'system\_20'}", "{'sessionid':'100001','timeid':21,'pagetype':'thankyou','pageid':111,'productprice':999.99,'productname':'system\_21'}" "{'sessionid':'100001','timeid':22,'pagetype':'productview','pageid':100,'productprice':999.99,'productname':'food3\_22'}", "{'sessionid':'100001','timeid':23,'pagetype':'productview','pageid':100,'productprice':999.99,'productname':'food3\_23'}", "{'sessionid':'100001','timeid':24,'pagetype':'productview','pageid':100,'productprice':999.99,'productname':'food3\_24'}", "{'sessionid':'100001','timeid':25,'pagetype':'submit','pageid':100,'productprice':999.99,'productname':'system\_25'}", "{'sessionid':'100001','timeid':26,'pagetype':'submit','pageid':100,'productprice':999.99,'productname':'system\_26'}", "{'sessionid':'100001','timeid':27,'pagetype':'checkout','pageid':100,'productprice':999.99,'productname':'system\_27'}", "{'sessionid':'100001','timeid':28,'pagetype':'thankyou','pageid':100,'productprice':999.99,'productname':'system\_28'}", "{'sessionid':'100001','timeid':29,'pagetype':'checkout','pageid':100,'productprice':1.99,'productname':'system\_29'}", "{'sessionid':'100001','timeid':30,'pagetype':'checkout','pageid':100,'productprice':1.99,'productname':'system\_30'}", "{'sessionid':'100005','timeid':0,'pagetype':'home','pageid':100,'productprice':100,'productname':'category\_0'}", "{'sessionid':'100005','timeid':1,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food1\_1'}", "{'sessionid':'100005','timeid':2,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food1\_2'}",
"{'sessionid':'100005','timeid':3,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food1_3'}", "{'sessionid':'100005','timeid':4,'pagetype':'home','pageid':100,'productprice':100,'productname':'category_4'}", "{'sessionid':'100005','timeid':5,'pagetype':'submit','pageid':100,'productprice':999.99,'productname':'system_5'}", "{'sessionid':'100005','timeid':6,'pagetype':'thankyou','pageid':100,'productprice':999.99,'productname':'system_6'}",
"{'sessionid':'100005','timeid':7,'pagetype':'checkout','pageid':100,'productprice':999.99,'productname':'system_7'}", "{'sessionid':'100005','timeid':8,'pagetype':'thankyou','pageid':100,'productprice':999.99,'productname':'system_8'}", "{'sessionid':'100005','timeid':9,'pagetype':'checkout','pageid':100,'productprice':89.99,'productname':'system_9'}", "{'sessionid':'100005','timeid':10,'pagetype':'thankyou','pageid':100,'productprice':10,'productname':'system_10'}", "{'sessionid':'100005','timeid':11,'pagetype':'home','pageid':100,'productprice':100,'productname':'category_11'}", "{'sessionid':'100005','timeid':12,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food2_12'}", "{'sessionid':'100005','timeid':13,'pagetype':'home','pageid':100,'productprice':100,'productname':'category_13'}", "{'sessionid':'100005','timeid':14,'pagetype':'checkout','pageid':100,'productprice':999.99,'productname':'system_14'}", "{'sessionid':'100005','timeid':15,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food2_15'}", "{'sessionid':'100005','timeid':16,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food2_16'}", "{'sessionid':'100005','timeid':17,'pagetype':'productview','pageid':100,'productprice':1500.32,'productname':'food2_17'}", "{'sessionid':'100005','timeid':18,'pagetype':'submit1','pageid':100,'productprice':100,'productname':'system_18'}", "{'sessionid':'100005','timeid':19,'pagetype':'submit2','pageid':100,'productprice':100,'productname':'system_19'}", "{'sessionid':'100005','timeid':20,'pagetype':'checkout','pageid':100,'productprice':999.99,'productname':'system_20'}", "{'sessionid':'100005','timeid':21,'pagetype':'thankyou','pageid':111,'productprice':999.99,'productname':'system_21'}", "{'sessionid':'100005','timeid':22,'pagetype':'productview','pageid':100,'productprice':999.99,'productname':'food3_22'}", "{'sessionid':'100005','timeid':23,'pagetype':'productview','pageid':100,'productprice':999.99,'productname':'food3_23'}", "{'sessionid':'100005','timeid':24,'pagetype':'productview','pageid':100,'productprice':999.99,'productname':'food3_24'}", "{'sessionid':'100005','timeid':25,'pagetype':'submit','pageid':100,'productprice':999.99,'productname':'system_25'}", "{'sessionid':'100005','timeid':26,'pagetype':'submit','pageid':100,'productprice':999.99,'productname':'system_26'}", "{'sessionid':'100005','timeid':27,'pagetype':'checkout','pageid':100,'productprice':999.99,'productname':'system_27'}", "{'sessionid':'100005','timeid':28,'pagetype':'thankyou','pageid':100,'productprice':999.99,'productname':'system_28'}", "{'sessionid':'100005','timeid':29,'pagetype':'checkout','pageid':100,'productprice':1.99,'productname':'system_29'}", "{'sessionid':'100005','timeid':30,'pagetype':'checkout','pageid':100,'productprice':1.99,'productname':'system_30'}", "{'sessionid':'100002','timeid':0,'pagetype':'home','pageid':100,'productprice':100,'productname':'system_01'}", "{'sessionid':'100002','timeid':1,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food3_02'}", "{'sessionid':'100002','timeid':2,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food3_03'}", "{'sessionid':'100002','timeid':3,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food3_04'}", "{'sessionid':'100002','timeid':4,'pagetype':'productview2','pageid':100,'productprice':100,'productname':'food3_05'}", "{'sessionid':'100002','timeid':5,'pagetype':'productview2','pageid':100,'productprice':100,'productname':'food3_06'}", "{'sessionid':'100002','timeid':6,'pagetype':'productview2','pageid':100,'productprice':100,'productname':'food3_07'}", "{'sessionid':'100002','timeid':7,'pagetype':'productview1','pageid':100,'productprice':100,'productname':'food3_08'}", "{'sessionid':'100002','timeid':8,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food3_09'}", "{'sessionid':'100002','timeid':9,'pagetype':'checkout','pageid':100,'productprice':999.99,'productname':'food3_10'}", "{'sessionid':'100002','timeid':10,'pagetype':'thankyou','pageid':111,'productprice':999.99,'productname':'food3_11'}", "{'sessionid':'100002','timeid':11,'pagetype':'checkout','pageid':100,'productprice':1.99,'productname':'food3_12'}", "{'sessionid':'100002','timeid':12,'pagetype':'checkout','pageid':100,'productprice':1.99,'productname':'food3_13'}", "{'sessionid':'100002','timeid':13,'pagetype':'checkout','pageid':100,'productprice':1.99,'productname':'food3_14'}", "{'sessionid':'100002','timeid':14,'pagetype':'home','pageid':100,'productprice':100,'productname':'system_15'}", "{'sessionid':'100002','timeid':15,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food3_16'}", "{'sessionid':'100002','timeid':16,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food3_17'}", "{'sessionid':'100002','timeid':17,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food3_18'}", "{'sessionid':'100002','timeid':18,'pagetype':'productview2','pageid':100,'productprice':100,'productname':'food3_19'}", "{'sessionid':'100002','timeid':19,'pagetype':'productview2','pageid':100,'productprice':100,'productname':'food3_20'}", "{'sessionid':'100002','timeid':20,'pagetype':'productview2','pageid':100,'productprice':100,'productname':'food3_21'}", "{'sessionid':'100002','timeid':21,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food3_22'}", "{'sessionid':'100002','timeid':22,'pagetype':'productview','pageid':100,'productprice':100,'productname':'food3_23'}", "{'sessionid':'100002','timeid':23,'pagetype':'checkout','pageid':100,'productprice':999.99,'productname':'food3_24'}", "{'sessionid':'100002','timeid':24,'pagetype':'thankyou','pageid':111,'productprice':999.99,'productname':'food3_25'}", "{'sessionid':'100002','timeid':25,'pagetype':'checkout','pageid':100,'productprice':1.99,'productname':'food3_26'}", "{'sessionid':'100002','timeid':26,'pagetype':'checkout','pageid':100,'productprice':1.99,'productname':'food3_27'}"
\)
val sqlStatm ="PARTITION by sessionid ORDER BY timeid "+"PATTERN\('H1+.D2{1,3}.X3\*.D2{1,2}.M1{2}.P4.S5'\) "+"SYMBOLS" +"\(" +"'true' AS X3," +"pagetype = 'home' AS H1," +"pagetype <> 'home' AND pagetype <> 'checkout' AS D2," +"pageid > 50 AND productprice > 92.00 AND lag\(pagetype,1,STR\)!=pagetype AS M1," +"pagetype = 'checkout' AND productprice > 102.00 AS P4," +"pagetype = 'thankyou' AND productprice > 101 AS S5" +"\) " +"RESULT" +"\(" +"First \(timeid OF ANY \(D2, X3\)\) AS timeid, " +"First \(pageid of H1\) AS pageid, " +"First \(productprice of P4\) AS productprice, " +"First \(1 OF ANY\) AS score\_col, " + "Accumulate \(CDISTINCT pagetype OF ANY \(D2,X3,P4\)\) AS products\_accumulate\_cdis, " +"Accumulate \(pagetype OF ANY \(D2,X3,P4\)\) AS products\_accumulate, " +"Accumulate \(pagetype OF ANY\) AS products\_accumulate\_any, " +"COUNT \(DISTINCT productprice OF ANY\(H1,D2,X3,P4,S5\)\) AS count\_products\_dis, " +"COUNT \(productprice OF ANY\(H1,D2,X3,P4,S5\)\) AS count\_products, " +"COUNT \(productprice OF ANY\) AS all\_counts, " +"MAX\_CHOOSE \(productprice, productname OF ANY\(H1,D2,X3,P4,M1,S5\)\) AS max\_product, "+"\) ORDER BY sessionid" +"SPATHVIZ"+"\(" +"Frequency\_Col \('score\_col'\), "+"Path\_Col \('products\_accumulate\_any'\), "+"Graph\_Type \('sankey'\)"+"\)";
val sqlContext = new SQLContext\(sc\)
val source = sc.parallelize\[String\]\(json\)
val df = sqlContext.read.json\(source\)
val pathResult = SPathDistribute.compute\(df, sqlContext, sqlStatm, SelectionPolicy.ALL\_TRUE\_LEAST\_POLICY, NFA.ALL\_MODE\)
val jsonconf = new VizSpathConfig
jsonconf.setVizType\(VizTypeForSPath.SANKEY\)
jsonconf.setTitle\("Spath——故障路径分析"\)
val taskId = Visualize.forSPath(jsonconf, pathResult.asInstanceOf[JSONObject], "Spath——故障路径分析2") print("[
http://vis.neuseer.com/chart/step/3?type=11&taskId="+taskId](http://vis.neuseer.com/chart/step/3?type=11&taskId="+taskId)\
)
以上代码中设置可视化展示的的示例代码部分为:
val jsonconf = new VizSpathConfig
jsonconf.setVizType\(VizTypeForSPath.SANKEY\)
jsonconf.setTitle\("Spath——故障路径分析"\)
val taskId = Visualize.forSPath(jsonconf, pathResult.asInstanceOf[JSONObject], "Spath——故障路径分析2")
print("[http://vis.neuseer.com/chart/step/3?type=11&taskId="+taskId](http://vis.neuseer.com/chart/step/3?type=11&taskId="+taskId)\)
输入完成后点击下图三角形图标运行
运行完成后,显示如下可视化地址,打开如下地址,进入可视化界面
输入创建可视化服务的用户名,密码
显示如下界面,输入此图表的名称,备注,点保存可以将spark分析的图表保存
点我的图表,右侧可看到已保存的图表
在我的仪表盘中新建一个仪表盘
切换到编辑模式模式后可以将我的图表中的任意图表加到新建的仪表盘中
在编辑模式下可以将图表进行放大缩小操作
我的数据集显示所有数据集
可以选择不同数据集创建图表
基础数据配置显示“图表类型”“算法类型”“图表与算法”