Statistical reference line component for charts.
Renders dashed horizontal or vertical lines at statistical positions
(average, median, min, max) or custom values. Auto-computes position
from data using ChartPipeline.stats/1.
Inspired by eCharts markLine.
Examples
<.mark_line
data={[100, 200, 150, 300, 250]}
type={:average}
y_pos={120.5}
width={340}
label="Avg"
/>
<.mark_line
type={:custom}
value={200}
y_pos={80.0}
width={340}
label="Target"
color="oklch(0.60 0.25 0)"
/>
Summary
Functions
Attributes
data(:list) - List of numeric values for auto-computing line position. Defaults to[].type(:atom) - Type of reference line. Defaults to:average. Must be one of:average,:median,:min,:max, or:custom.value(:any) - Custom value (used when type is :custom). Defaults tonil.axis(:atom) - Which axis the line crosses. :y = horizontal line, :x = vertical line. Defaults to:y. Must be one of:x, or:y.scale(:any) - Scale function to convert data value to pixel position. Defaults tonil.x(:any) - X offset for horizontal lines (left edge of chart area). Defaults to0.y_pos(:any) - Pre-computed Y pixel position (overrides scale computation). Defaults tonil.width(:any) - Line width in pixels. Defaults to340.height(:any) - Line height for vertical lines. Defaults tonil.label(:any) - Label text displayed at line end. Defaults tonil.show_value(:boolean) - Show the numeric value in the label. Defaults totrue.color(:string) - Line and label color. Defaults to"oklch(0.60 0.25 0)".dash_array(:string) - SVG stroke-dasharray pattern. Defaults to"4 3".class(:string) - Defaults tonil.- Global attributes are accepted.