Skip to content

Link row and chart hover

Hover a row to see its stable key drive another view. Replace the text in this example with your chart’s semantic hover API.

import { RowChartHoverPlugin } from '@revolist/revogrid-pro';
grid.rowChartHover = {
key: 'id',
onHover: (key, row) => updateChartHover(key, row),
};
grid.plugins = [RowChartHoverPlugin];
const plugin = (await grid.getPlugins()).find(
(p) => p instanceof RowChartHoverPlugin,
);
// For hover originating in the chart:
plugin?.setActiveKey(chartRowKey); // Pass null to clear.

Keys must be stable strings or finite numbers. onHover receives the key and row model on entry, and null on leave. setActiveKey does not call onHover, avoiding a feedback loop. Active row segments receive data-row-chart-active="true" for host styling. Source replacement clears the active state.

For category-based charts, createCategoryRowHoverLink maps chart categories to row keys and coordinates asynchronous hover updates. Supply getChart and getRowPlugin, forward the chart hover callback to link.onChartHover, and call link.reset() before replacing the chart and link.destroy() on teardown. Use categoryKey for custom identities and invalidateCategories() when externally defined mappings change.