我开始在R套餐中使用googleVis。我的问题是,我无法找到一个解决方案,用于在列表中隐藏不需要的列,我想在事件监听器处理程序上使用它。在我的柱形图上,我只想显示milk_yiel_305和milk_yield_lactation的列。同时我想传递一个seqvence_id,它将用作jscode中的参数。
这是我的代码:
/ * ** * *** 示例代码 的 ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * *** /
library(googleVis)
# experimental data
df=data.frame(lactation=c("1", "2", "3", "4","5"),
seqvence_id=c(2758829,3735102,4751006,5826611,7059361),
milk_yiel_305=c(5867,8147,8050,7904,6326),
milk_yield_lactation=c(5867,8147,8875,9308,6326))
# Java script for look up of detailed lactation data (milk recordings)
jscode <- "window.open('https://www.govedo.si/pls/govedo/!portal_pkg.izpis?p_lak_id_seq='+data.getValue(chart.getSelection()[0].row,0)+'&e=1&p_procedura=portal2_pkg.rpt_izpis_kontrol2&p_menu=SI'); "
#name of the graph, because of reason that I will use many of then on the same page
v_graph_name <- gsub(" ","",paste("L",parameter1))
#column chart
Lactation_bars <- gvisColumnChart(df, xvar="lactation", yvar=c("seqvence_id","milk_yiel_305","milk_yield_lactation"),
chartid=v_graph_name,
options=list(
width=550,
height=390,
displayAnnotations=TRUE,
gvis.listener.jscode=jscode,
series= "{0:{color: 'green', visibleInLegend: true}, 1:{color: 'blue', visibleInLegend: true}}",
vAxis="{title:'kg mleka', titleTextStyle: {color: 'black',fontSize:12}}",
hAxis="{title:'Zaporedna laktacija', titleTextStyle: {color: 'black', fontSize:12}}",
vAxis.viewWindowMode='maximized',
legend='in'
)
)
plot(Lactation_bars)
#file wher I save Html for later use in Oracle Web Application
#cat(iconv(gsub(pattern = "UTF-8", replacement = "windows-1250",
#createGoogleGadget(Editor )), "ISO-8859-2", "UTF-8"), file=ime_datoteke)
/ * ** * *** 示例代码 < /强> 的 ** * ** * ** * ** * 的** * ** * ** * ** * ** * 的* /
感谢您的及时回复。