suiss/uim · Chart

Line Chart Forecast

A twelve-month line with actual values in solid and a forecast in dashed, over a shaded future range.

Line Chart Forecast is an open-source mobile chart from suiss/uim, drawn with react-native-svg for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Line (forecast) on iOS in light mode

Two series share one axis: actual fills the first nine months and forecast continues from September, drawn with strokeDasharray. A ReferenceArea shades September to December to mark the forecast period. Missing values are null, so each line stops where its data ends.

Installation

$ pnpm dlx @esuiss/uim@latest add line-chart-forecast

The CLI also adds what it builds on: Card, Chart.

Manual

  1. Add the pieces it builds on: Card, Chart.

  2. Copy the source into components/charts/line-chart-forecast.tsx:

uniwind/components/charts/line-chart-forecast.tsx
import {
  Card,
  CardContent,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"
import {
  CartesianGrid,
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,
  Line,
  LineChart,
  ReferenceArea,
  1. Update the import paths to match your project.

Usage

import { LineChartForecast } from "@/components/charts/line-chart-forecast"
<LineChartForecast />

Replace the actual and forecast arrays; the forecast starts at the index set in chartData. Move the ReferenceArea x1 and x2 to match your forecast range. The component takes no props.