@mui/x-charts
Version:
The community edition of MUI X Charts components.
30 lines (28 loc) • 793 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createIsHighlighted = createIsHighlighted;
function alwaysFalse() {
return false;
}
/**
* The isHighlighted logic for main charts (those that are identified by an id and a dataIndex)
*/
function createIsHighlighted(highlightScope, highlightedItem) {
if (!highlightScope || !highlightedItem) {
return alwaysFalse;
}
return function isHighlighted(item) {
if (!item) {
return false;
}
if (highlightScope.highlight === 'series') {
return item.seriesId === highlightedItem.seriesId;
}
if (highlightScope.highlight === 'item') {
return item.dataIndex === highlightedItem.dataIndex && item.seriesId === highlightedItem.seriesId;
}
return false;
};
}