This function implements a custom callback for datacursormode. It overrides the default functionality (that displays the x-y values of the last line selected) by adding a dragable vertical line and displaying the x-y values of all lines on an axis.
Note: Due to some issues with graphics listeners that this file does not deal with:
1. The title of the datacursormode display box shows the name of the last signal selected (rather than a generic title)
2. If changes are made to the legend, more lines are added to the axis, or the Display Style is changed from Datatip to Window Inside Figure, the user needs to turn datacursor mode off then back on again to see the correct display.
Phil Goddard (2022). custom datacursormode (https://www.mathworks.com/matlabcentral/fileexchange/8004-custom-datacursormode), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!