datacursormode
Enable data cursor mode
Description
You can use data cursor mode to explore data by interactively creating and editing
data tips. Data tips are small text boxes that display information about individual data
points. Enable or disable data cursor mode, and set other basic options, by using the
datacursormode
function. To control data tip appearance and behavior,
return and use a DataCursorManager
object.
Most charts support data tips, including line, bar, histogram, and surface charts. Charts that support data tips typically display the data tips icon in the axes toolbar.
You can also interactively explore data using built-in axes interactions that are enabled by default. For example, you can temporarily display a data tip by pausing on a data point, or you can pin a data tip by clicking on a data point. Built-in interactions do not require you to enable an interaction mode and respond faster than interaction modes. However, you can enable data cursor mode to customize data tip behavior. For more information about built-in interactions, see Control Chart Interactivity.
Creation
Syntax
Description
datacursormode
sets the data cursor
mode for all axes in the current figure. For example, option
datacursormode
on
enables data cursor mode and datacursormode off
disables data cursor mode.
When data cursor mode is enabled, create a data tip using either the cursor or the keyboard.
Cursor — Click a plotted data point. To create multiple data tips, hold the Shift key as you select data points. To move a data tip to another data point, drag the point where the data tip is located.
Keyboard — For some charts, to move the currently selected data tip to another data point, press the up arrow (↑), down arrow (↓), left arrow (←), or right arrow (→) key.
Some built-in interactions remain enabled by default, regardless of the current
interaction mode. To disable built-in data tip interactions that are independent of the
data cursor mode, use the disableDefaultInteractivity
function.
datacursormode
toggles data cursor mode between
on
and off
.
Input Arguments
Properties
Object Functions
getCursorInfo | The Calling
|
Examples
Tips
In general, data tips show the coordinates of the selected data point. However, for some types of charts, data tips display specialized information. For example, histograms created using the
histogram
function display data tips that itemize the observation counts and bin edges.
Alternative Functionality
Axes Toolbar
For some charts, enable data cursor mode by clicking the data tips icon in the axes toolbar.
Programmatic Workflow
To programmatically create and customize data tips, use the datatip
and
dataTipTextRow
functions. For more information, see Create Custom Data Tips.