从文档中,我找到了 自定义按钮 和点击事件。但是,我不知道如何将它们配对以实现它,因此当我单击平行坐标图中的 y 轴时,它会删除该轴。
编辑:我试过的:似乎我可以选择点,但不能选择线。
plot_ly(partial, type = 'parcoords',
line = list(color = partial$freq,
colorscale = 'Jet',
showscale = TRUE,
reversescale = TRUE,
cmin = min_freq,
cmax = max_freq),
dimensions = interactiveList
) %>%
layout(title=name) %>%
onRender("
function(el, x) {
console.log('entered');
console.log(el);
el.on('plotly_click', function(d) {
// d.points is an array of objects which, in this case,
// is length 1 since the click is tied to 1 point.
console.log('lalala');
var pt = d.points[0];
var url = pt.data.text[pt.pointNumber];
// DISCLAIMER: this won't work from RStudio
console.log('hello');
window.open(url);
});
el.on('plotly_selected', function(d) {
console.log('selected');
});
}
")