Trend Chart
A gradient area trend chart with real-time scrub indicators and value tracking.
// SYSTEM.STAGE
Installation
Install the component and its peer dependencies automatically via the CLI:
// SYS.USAGE
Drop this code into your screen or view:
1import TrendChart from "@/components/trend-chart";2 3export default function PerformanceScreen() {4 const trendData = [5 { label: "Mon", value: 1200 },6 { label: "Tue", value: 2400 },7 { label: "Wed", value: 1800 },8 { label: "Thu", value: 3600 },9 { label: "Fri", value: 2900 },10 { label: "Sat", value: 4800 },11 { label: "Sun", value: 4100 },12 ];13 14 return (15 <TrendChart16 data={trendData}17 theme="dark"18 accentColor="#10B981"19 title="Revenue Growth"20 subtitle="vs previous period"21 height={150}22 onPointSelect={(point, index) => {23 console.log("Selected trend point:", point, "at index:", index);24 }}25 />26 );27}// SPEC.PROPS_API
Configurable interfaces for <TrendChart />
| PROP_IDENTIFIER | TYPE_SIGNATURE | DEFAULT_VAL | TELEMETRY_NOTES |
|---|---|---|---|
| data | TrendDataPoint[] | DEMO_CHART_DATA | Array of data points with numeric value and string label. |
| height | number | 150 | Height of the SVG trend line canvas in pixels. |
| theme | "dark" | "light" | "dark" | Color theme mode for card background, borders, and typography. |
| accentColor | string | "#10B981" | Accent color for the smooth spline line, gradient glow, and indicator. |
| title | string | "7-Day Activity Trend" | Title displayed in the metrics header. |
| subtitle | string | "growth vs last week" | Context note displayed beside the delta percentage badge. |
| unit | string | "" | Optional metric unit label displayed beside the rolling value. |
| onPointSelect | (point: TrendDataPoint, index: number) => void | undefined | Callback fired when a data point along the spline is scrubbed or tapped. |
Array of data points with numeric value and string label.
DEMO_CHART_DATAHeight of the SVG trend line canvas in pixels.
150Color theme mode for card background, borders, and typography.
"dark"Accent color for the smooth spline line, gradient glow, and indicator.
"#10B981"Title displayed in the metrics header.
"7-Day Activity Trend"Context note displayed beside the delta percentage badge.
"growth vs last week"Optional metric unit label displayed beside the rolling value.
""Callback fired when a data point along the spline is scrubbed or tapped.
undefined// PERFORMANCE_&_A11Y
Native touch gestures, screen reader attributes, and 60–120 FPS frame budgets: