Changing Line Thickness And Opacity In Scatterplot On OnRender() HtmlWidgets In R
I am hoping to make a plot using the R package htmlwidgets' onRender() function in which a user can click on a point and a line is drawn. I have the crux of it working right now wh
Solution 1:
The opacity
would need to be in the trace object. Your line object has some syntax issues which prevents Javascript from reading it.
gp %>% onRender("
function(el, x, data) {
el.on('plotly_click', function(e) {
var trace1 = {
x: [100, 400],
y: [100, 400],
mode: 'lines',
line: {
color: 'gray',
width: 100
},
opacity: 0.8,
}
Plotly.addTraces(el.id, trace1);
})
}", data=dat)
Post a Comment for "Changing Line Thickness And Opacity In Scatterplot On OnRender() HtmlWidgets In R"