【发布时间】:2017-08-17 09:49:00
【问题描述】:
我正在使用 R htmlwidget 包,它以 html 的形式保存 plotly graph。函数htmlwidget::savewidget()save graph 为 html 文件。现在我们需要在 htmlwidget::savewidget() 生成的 plotly html 文件中包含一个自定义 js 文件以进行其他操作,例如单击图形等...
例如,我的 custom.js 文件包含以下代码。
<script type="text/javascript">
$( document ).ready(function() {
$('#htmlwidget_container').on('plotly_click', function(data){
alert('You clicked this Plotly chart!');
});
});
</script>
【问题讨论】:
标签: r plotly htmlwidgets