Documentation

Report Edit

MarkerLine

import {MarkerLine} from 'cx/charts';

Marker lines can be used to highlight important values such as minimum or maximum.

050100150200250300350400406080100120140MinMax
ControllerIndex
<div class="widgets" controller={PageController}>
    <Svg style="width:600px; height:400px;">
        <Chart
            offset="20 -10 -40 40"
            axes={{
                x: {type: NumericAxis},
                y: {type: NumericAxis, vertical: true, deadZone: 20}
            }}
        >
            <Gridlines/>
            <MarkerLine y-bind="$page.extremes.min" colorIndex={6}>
                <Text anchors="0 0 0 0" offset="5 0 0 5" dy="0.8em">Min</Text>
            </MarkerLine>
            <MarkerLine y-bind="$page.extremes.max" colorIndex={3}>
                <Text anchors="0 0 0 0" offset="-5 0 0 5">Max</Text>
            </MarkerLine>
            <LineGraph data-bind="$page.points" colorIndex={0}/>
        </Chart>
    </Svg>
    <Legend />
    <Button onClick="generate">
        Generate
    </Button>
</div>
Copied!Cx Fiddle

Note how deadZone is used on the vertical axis to reserve space for min/max labels.

Configuration

PropertyDescriptionType
affectsAxes

Used to indicate if the data should affect axis span.

boolean
colorIndex

Index of a color from the standard palette of colors. 0-15.

number
colorMap

Used to automatically assign a color based on the colorName and the contextual ColorMap widget.

string
colorName

Name used to automatically resolve color based from the contextual ColorMap widget. If value is not provided, name is used instead.

string
name

Name of the item as it will appear in the legend.

string
x

Shared x1 and x2 value binding or expression.

number
x1

The x1 value binding or expression.

number
x2

The x2 value binding or expression.

number
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

Shared y1 and y2 value binding or expression.

number
y1

The y1 value binding or expression.

number
y2

The y2 value binding or expression.

number
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
active

Used to indicate if an item is active or not. Inactive items are shown only in the legend.

boolean
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
legend

Name of the legend to be used. Default is legend. Set to false to hide legend entry for this item.

string | false
legendAction

Action to be performed if the user clicks on the legend entry. Default value is auto. Other permitted values are toggle and select.

string
legendShape

Shape of the icon in the the legend. Default value is based on the chart type. Additional shapes can be registered using the registerShape function. Out of the box, CxJS offers square, bar, column, line, vline and triangle shapes.

string
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