Implements selection highlighting using plotly's native selectedpoints mechanism. This leverages plotly's built-in selection system which works consistently across all chart types without hardcoded styling values.
apply_default_plotly_behavior(plot_proxy, selected_row, session, component_id)NULL (invisible). Function is called for side effects only.
plotlyProxy object for the target plot.
Data frame row containing the selected data point, or NULL for deselection.
Shiny session object for the current user session.
Character string. ID of the plotly component for reference.
This function uses plotly's native selection capabilities by:
Finding points using key or customdata across all traces
Applying plotly's built-in selectedpoints styling
Using plotly's default selected/unselected appearance
Working generically across all plot types and trace structures
For native plotly selection highlighting to work, your Shiny UI must include a custom JavaScript message handler:
tags$script(HTML("
Shiny.addCustomMessageHandler('eval', function(code) {
try {
eval(code);
} catch(e) {
console.error('JavaScript execution error:', e);
}
});
"))
This enables linkeR to send selection updates to plotly charts for visual feedback.
The selection highlighting follows plotly's native behavior and appearance, ensuring consistency with user expectations and plotly's design system.