齐柏林飞艇笔记本电脑的动态交互式仪表板 [英] dynamic interactive dashboard with zeppelin notebook

查看:120
本文介绍了齐柏林飞艇笔记本电脑的动态交互式仪表板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个更具交互性的仪表板.就像从数据库中读取数据,将其提供给选择框,选择框更改后发送值并运行查询.

I want to have a more interactive dashboard. like reading the data from database , giving it to select box, onchange of select box send the value and run the query.

我想在选择的值上使用齐柏林飞艇bcz来实现此目的,因此我必须显示分析数据.

i want to achieve this using zeppelin bcz on selected value i have to display the analytics.

实现此目标的方式是什么,并且可能通过齐柏林飞艇来实现.

what would be the way to achieve this and is this possible to achieve through zeppelin.

我尝试了选择框,但是我无法保存选择的值并将其发送到下一个查询并执行. 像

i tried with select box, but i couldnot save the selected value and send it to next query and execute that. something like

select age, count(1) value 
from bank 
where marital="${marital=single,single|divorced|married}" 
group by age 
order by age

我不知道如何存储此参数以及如何将选定的参数从一个段落发送到另一段

i didnt get how to store this parameter and send selected parameters from one paragraph to another

或诸如从UI处理所有这些事情之类的东西,让我们说javascript html并将所选值作为参数发送给齐柏林飞艇?就像是 使用网址时

or something like handling all these things from UI, lets say javascript html and sending that selected value as parameter to the zeppelin? something like this while using the url

<iframe src="http://myipaddress:8080/#/notebook/2BWCNP7V8/paragraph/20160831-115204_1774035770?asIframe&param1=value1&param2=value2" width="500" height="300"  scrolling="no" frameBorder="0" id="iframe1" style="text-align:center;" >Browser not compatible.</iframe>

并在我的齐柏林飞艇段落中使用这些param1 = value1& param2 = value2? 从技术上可行还是不明白. 请帮助我如何实现这一目标? 在此先感谢:)

and using these param1=value1&param2=value2 in my zeppelin paragraph? technically doable or not i dont understand. please help me how to achieve this? thanks in advance :)

推荐答案

我们可以使用以下代码获取所有婚姻信息

We can get all the maritals with following code

val maritals = bank.select("marital").distinct.collect.map(_.getString(0))

并转换为ZeppelinContext所需的seq

And convert to seq ZeppelinContext wanted

val seq = mairitals.zipWithIndex.map{case (x,y) => (y.toString, x)}.toSeq

然后我们可以像这样选择它

Then we can select it like this

val index = z.select("marital", "1", seq)
val marital = seq(index.toString.toInt)._2

marital可用于进一步处理.喜欢.

And the marital can use be used for further processing. like.

val sql = s"""select distinct job from bank where marital=="$marital""""

sqlContext.sql(sql).show

或者就像当我使用 spark-highcharts 一样.在这种情况下,我想绘制某些婚姻状况下各个年龄段的平均余额.

Or like when I use spark-highcharts. In this case I wanna plot average balance over age for certain marital status.

highcharts(bank.filter(col("marital") === marital)
  .series("x" -> "age", "y" -> avg(col("balance")))
  .orderBy(col("age"))).plot()

注意:更改值后,只有带有select的段落会自动执行.

NOTE: Only the paragraph with the select will be executed automatically when value changed.

这篇关于齐柏林飞艇笔记本电脑的动态交互式仪表板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆