Documentation

Report Edit

MouseTracker

import {MouseTracker} from 'cx/charts';

The MouseTracker widget is used to track mouse position on the chart.

020406080100020406080100

MouseTracker is commonly used with point reducers to track values on the graph.

Index
<Svg style="width:600px;height:500px;" margin="60 60 60 60">
    <Chart axes={{
        x: <NumericAxis min={0} max={100} />,
        y: <NumericAxis min={0} max={100} vertical/>,
    }}>
        <Gridlines />
        <MouseTracker
            x-bind="$page.cursor.x"
            y-bind="$page.cursor.y"
            tooltip={{
              destroyDelay: 5,
              createDelay: 5,
              text: { tpl: "({$page.cursor.x:n;1}, {$page.cursor.y:n;1})" },
              trackMouse: true
            }}
        >
            <Marker visible-expr="!!{$page.cursor}" x-bind="$page.cursor.x" y-bind="$page.cursor.y" size={10}/>
            <MarkerLine visible-expr="!!{$page.cursor}" x-bind="$page.cursor.x" y2-bind="$page.cursor.y" y1={0}/>
            <MarkerLine visible-expr="!!{$page.cursor}" y-bind="$page.cursor.y" x2-bind="$page.cursor.x"/>
        </MouseTracker>
    </Chart>
</Svg>
Copied!Cx Fiddle
PropertyDescriptionType
x

A binding used to receive a value tracked from the x axis.

object
xAxis

Name of the horizontal axis. The value should match one of the horizontal axes set in the axes configuration of the parent Chart component. Default value is x.

string
y

A binding used to receive a value tracked from the y axis.

object
yAxis

Name of the vertical axis. The value should match one of the vertical axes set in the axes configuration if the parent Chart component. Default value is y.

string
anchors

Anchor defines how child bounds are tied to the parent. Zero aligns with the top/left edge. One aligns with the bottom/right edge. See Svg for more information.

string/number/rect
class
className

Additional CSS classes to be applied to the element. If an object is provided, all keys with a "truthy" value will be added to the CSS class list.

string/object
items
children

List of child elements.

array
margin

Apply margin to the given boundaries. See Svg for more information.

string/number/rect
mod

Appearance modifier. For example, mod="big" will add the CSS class .cxm-big to the block element.

string/array
offset

Move boundaries specified by the offset. See Svg for more information.

string/number/rect
outerLayout

Defines the outer layout which wraps the widget.

widget
padding

Padding to be applied to the boundaries rectangle before passing to the children.

string/number/rect
plainText

Set to true to avoid converting inner strings to templates. Default is false.

boolean
preserveWhitespace
ws

Keep whitespace in text based children. Default is false. See also trimWhitespace.

boolean
putInto
contentFor

Used with outer layouts. Specifies the name of the content placeholder which should render the widget.

string
style

Style object applied to the wrapper div. Used for setting the dimensions of the element.

string/object
trimWhitespace

Remove all whitespace in text based children. Default is true. See also preserveWhitespace.

boolean
vdomKey

Key that will be used as the key when rendering the React component.

string
visible
if

Visibility of the widget. Defaults to true.

boolean