MarkerLine
import { MarkerLine } from 'cx/charts'; Copied MarkerLine draws horizontal or vertical lines to highlight important values such as minimum, maximum, thresholds, or averages. Child elements (like Text) can be placed inside to add labels.
<div controller={PageController}>
<Svg style="width: 100%; height: 350px">
<Chart
offset="20 -10 -40 40"
axes={{
x: { type: NumericAxis },
y: { type: NumericAxis, vertical: true, deadZone: 20 },
}}
>
<Gridlines />
<MarkerLine y={m.extremes.min} colorIndex={6}>
<Text anchors="0 0 0 0" offset="5 0 0 5" dominantBaseline="hanging">
Min
</Text>
</MarkerLine>
<MarkerLine y={m.extremes.max} colorIndex={3}>
<Text anchors="0 0 0 0" offset="-5 0 0 5">
Max
</Text>
</MarkerLine>
<LineGraph data={m.points} colorIndex={0} />
</Chart>
</Svg>
<Legend />
<Button onClick="generate">Generate</Button>
</div> Note how
deadZoneis used on the vertical axis to reserve space for min/max labels.
Configuration
| Property | Type | Default | Description |
|---|---|---|---|
x | number | Draw a vertical line at this x value. | |
y | number | Draw a horizontal line at this y value. | |
colorIndex | number | Color palette index. | |
colorMap | string | Name of the color map to use. | |
colorName | string | Name for color map lookup. | |
name | string | Name for legend. | |
legend | string | "legend" | Legend name to show in. |
active | boolean | true | Whether the line is active (visible). |
affectsAxes | boolean | true | Whether line position affects axis range. |
lineStyle | string | CSS style string for the line. | |
class | string | CSS class for the line element. |