suiss/uim · Chart

Line Chart Goal Dots

A weekly sleep chart where each night's dot is green if it met the goal and orange if it did not.

Line Chart Goal Dots 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 (goal dots) on iOS in light mode

Seven nights of sleep drawn as a monotone line. The dot prop is a function that colors each point by comparing it with GOAL, and a dashed green ReferenceLine marks the goal itself. The tooltip formats values as hours and minutes.

Installation

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

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

Manual

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

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

uniwind/components/charts/line-chart-goal-dots.tsx
import { View } from "react-native"
import { Card, CardContent, CardHeader } from "@/components/ui/card"
import {
  CartesianGrid,
  type ChartConfig,
  ChartContainer,
  ChartTooltip,
  ChartTooltipContent,
  Line,
  LineChart,
  ReferenceLine,
  XAxis,
  YAxis,
} from "@/components/ui/chart"
import { Text } from "@/components/ui/text"
  1. Update the import paths to match your project.

Usage

import { LineChartGoalDots } from "@/components/charts/line-chart-goal-dots"
<LineChartGoalDots />

Replace chartData with your nightly hours and set GOAL. The header average is static text, so update it with your own value. The component takes no props.