react-sparklines-ts
Version:
Beautiful and expressive Sparklines component for React (continued)
9 lines (8 loc) • 545 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import * as dataProcessing from "./dataProcessing/index";
export default function SparklinesReferenceLine(props) {
const { points, margin, type, style, value } = props;
const ypoints = points.map((p) => p.y);
const y = type === "custom" ? value : dataProcessing[type ?? "mean"](ypoints);
return (_jsx("line", { x1: points[0].x, y1: y + margin, x2: points[points.length - 1].x, y2: y + margin, style: style ?? { stroke: "red", strokeOpacity: 0.75, strokeDasharray: "2, 2" } }));
}