问题标签 [htmlwidgets]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
373 浏览

javascript - Tying an R htmlwidget to a shiny output

I have a working htmlwidget that does prints a matrix as a table and allows editing of that table. The widget is meant to be embedded into a shiny app as a demonstration of contingency tables. All the code is here:

https://github.com/richarddmorey/contingencyTablesShiny

The README gives instructions for how to start the shiny app.

Currently I have it working as an shiny input. This is pretty neat, because one can type in the matrix table and update the numbers, and the contingency table statistics dynamically update.

What I can't figure out how to do is connect the other shiny inputs to re-recreate the htmlwidget, e.g., to change the size of the table with shiny sliders. I gather I need to use the htmlwidget as a shiny output to do this, but I'm not sure how. When I try to change the widget to an output instead of an input (see commented out code here:

https://github.com/richarddmorey/contingencyTablesShiny/blob/master/ct/inst/shiny-apps/app1/ui.R#L48

and here:

https://github.com/richarddmorey/contingencyTablesShiny/blob/master/ct/inst/shiny-apps/app1/server.R#L18-L29

it fails to print any widget, and I get an error in the javascript console:

in _processHtml — output_binding_html.js:190

Line where the error occurs

I suspect this has to do with how I'm sending the return value of the output render function for my widget, but I can't figure out why it won't work.

0 投票
1 回答
214 浏览

html - 如果 Leaflet 和 DT 小部件在 R 中保存为 HTML,为什么它们会显示空白屏幕?

我在 Linux 环境中,我想使用LeafletDT在 R 中制作独立的 HTML 小部件,并使用htmlwidgets插件生成 HTML 。问题是当我尝试打开这些生成的 HTML 文件时,浏览器是空白的,并且根据控制台会出现某种 JSON 解析错误。

它只发生在 Linux 中。我已经在 Windows 上使用 Rstudio 进行了尝试,效果很好。

我还发现在 Windows 上,与 Linux 不同,javascript 小部件在 HTML 文件中是 base64 编码的。

我不认为这是htmlwidgets的问题,因为我使用了其他小部件库(rPivotTableplotly等),并且它们在带有htmlwidgets的 Linux 上工作得很好。

输出sessionInfo()

R version 3.3.1 (2016-06-21) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.4 LTS

R 包和版本:

  • 情节_4.5.6
  • ggplot2_2.2.0
  • rpivotTable_0.1.5.10
  • htmlwidgets_0.8
  • DT_0.1
  • 传单_1.0.1

知道是什么原因造成的吗?有没有人经历过类似的事情?我读过具有类似症状的问题,但没有一个答案能解决我的问题。

0 投票
1 回答
889 浏览

r - rpivotTable: 更新调整的shinyapp 数据透视表的动态pdf下载

我想问一个关于使用rpivotTable带有刷新调整的包的数据透视表的pdf下载的问题。

我非常接近我想要的,但只需要最后一步。

这是我的代码:

闪亮的应用程序:app.r:

我对 pdf 的降价:Rmd:

数据透视表顶部的文本输出是rPivotTable包的正确参数输入,所以我唯一需要做的就是将它们放入参数输入区域。我尝试writeLines()但它不工作。

其他一切都已经设置好,唯一的问题是如何放置参数##### Replace "pivotRefresh2()" Here

太感谢了!

此致!

0 投票
0 回答
635 浏览

html - 打开,阅读 html 小部件?

我使用以下方法将脚本中的一些图形保存为 html 对象:

是否可以将此对象读回 R 中?我在 htmlwidgets 文档中找不到任何内容:https ://cran.r-project.org/web/packages/htmlwidgets/htmlwidgets.pdf

用于在 R 中打开或读取对象?

0 投票
1 回答
2816 浏览

r - 带有 d3treeR 的交互式树形图未在 Shiny 中渲染

我是 Shiny 的新手,我正在尝试使用d3TreeR HTML Widget来显示交互式树状图

我使用了以下代码,它在 R 中完美运行:

我正在尝试让它在 Shiny 中渲染并使用以下代码:

附加示例数据以使其可重现:https ://drive.google.com/open?id=0B2LJXtBTsuhhcnZJeXI3T0kwYW8 我知道我可能遗漏了一些非常明显的东西 - 但我无法发现它!任何帮助都会非常棒!谢谢!

0 投票
2 回答
12669 浏览

html - 来自 R 中 htmlwidget 的 savewidget,无法将 html 文件保存在另一个文件夹中

我有一张地图传单,我想将其保存在特定文件夹中的 html 文件中。我正在使用 Windows 7。

我尝试了以下方法:

作为错误消息,根据 Rstudio 会话,我要么有

1) setwd(dir) 中的错误:无法更改工作目录

2) 找不到路径

当我只保存这样的:

它完美地工作。

预先感谢您的帮助。

0 投票
0 回答
475 浏览

r - R中的rpivotTable:是否可以在选择区域中使某个变量名不可见?

我想友好地问一下,如果有人知道在 R 中使用 'rpivotTable()' 包时如何使某个变量名在选择区域中不可见?

例如,我使用“UCBAdmission”数据集构建了一个数据透视表:

是 的输出rp输出截图

但是,如果用户不小心将“Freq”拖到“col”或“row”区域,表格会很大,但这不是我想要的。

所以我想找到一种方法让“频率”从选择区域不可见。我在这里使用了代码,但这只能自定义整个表,但不能自定义单个变量。

我不知道如何控制单个变量的自定义。有谁知道它或对此有任何想法?

我很感激任何答复。

谢谢!

此致

0 投票
2 回答
1962 浏览

r - 为什么绘图渲染图在 Mozilla 上不起作用

尝试在 Mozilla Firefox 中打开与 knitr 放在一起的 html 文档时出现以下错误。plotly该错误是由包组成的图形元素的结果。

rmarkdown 文件的全部内容(默认其他所有内容):

我有最新版本的 Firefox。我似乎在查看其他带有情节元素的页面时没有问题。该页面在IE中工作,没问题。

0 投票
1 回答
866 浏览

r - 将 htmlwidget 添加到传单对象的弹出窗口

我正在使用 R 组合传单对象和 dygraph。

特别是我希望一个 dygraph(理想情况下是任何 htmlwidget)显示为地图上点的弹出窗口。

下面是我大致尝试生成的代码。

理想情况下,当用户单击标记时,dygraph 应该出现在弹出窗口中。

0 投票
1 回答
113 浏览

javascript - 使用来自 JavaScript (D3r) 的警报将​​数据传递给 R

我需要将数据从 Sunburst 图传递到 R(服务器端)。以下代码创建了一个旭日形图并在您选择的级别上发出警报(Kerry 的礼貌以及他在 HTMLWidgets 和 SunburstR 方面的出色工作)。我希望能够传递该信息,以便创建下载列表。