I want to use plotly in an interactive line graph and needs point selection as a part of the interaction. So far plotly does not highlight the selected points. Is there a way to enable this?
For example, when a point on a line chart is clicked, it will display in different marker symbol / color. Or is there a fast way to achieve this?
Plotly exposes click and hover events, so you can do things like this:
var myDiv = document.getElementById('my-div');
Plotly.plot(myDiv, [{ x: [1,2,3], y: [5,7,2] }], {});
myDiv.on('plotly_click', function(evt){
// Do something with the data from the event,
// for example, calling `Plotly.restyle`
});
Somehow I don’t find a way to highlight one point after selection. The ‘restyle’ function only allows restyling one entire trace. I want to select two points from same time series and mark the points on the graph. So is the ‘select + highlight point’ effect possible in Plotly?
The Google charts has something I described. When you click on the chart it will mark the point:
how would you apply this in R with shiny? I would love to restyle the color palette based on a users choice for a new color, and apply a new pallette to all traces using a modification of the Plotly.restyle(‘graph’, ‘marker.color’, [[‘red’, ‘green’,‘blue’]] approach