[charts] onHighlightChange
behavior with showMarks={false}
in <LineChart>
component
#15617
Labels
bug 🐛
Something doesn't work
component: charts
This is the name of the generic UI component, not the React module!
Steps to reproduce
• Output should include a valid dataIndex (e.g., { seriesId: 'setpoint', dataIndex: 198 }).
• Output will include dataIndex: undefined (e.g., { seriesId: 'setpoint', dataIndex: undefined }).
This behavior demonstrates that dataIndex is only populated when showMarks is enabled, which appears to link it to the visibility of markers.
Current behavior
I noticed an inconsistency in the behavior of the onHighlightChange event handler in the Material UI component.
When showMarks is set to false, the handler returns:
However, when showMarks is set to true, it correctly returns:
This means the dataIndex value is only available when showMarks is enabled, which seems to tie the highlighting functionality to the visual markers.
Is this limitation by design, or could this be improved to decouple the onHighlightChange behavior from the showMarks setting? If it is feasible, adding this feature would be greatly appreciated.
Thank you for your attention to this matter!
Expected behavior
The onHighlightChange event should provide the dataIndex of the highlighted element regardless of the showMarks setting.
For example, when showMarks is set to false, the output should still include the correct dataIndex:
his would decouple the highlighting functionality from the visual rendering of markers, making it consistent and usable for large datasets where showMarks cannot be enabled due to performance constraints.
Context
I am working with large datasets, and enabling showMarks is not viable due to performance concerns. It would be great if onHighlightChange could consistently provide the dataIndex regardless of the showMarks state.
Your environment
Search keywords: LineChart onHighlightChange
Search keywords:
The text was updated successfully, but these errors were encountered: