A reusable chart system for mobile apps, inspired by the DX of shadcn/ui.
chartcn-mobile does not replace chart engines. It standardizes:
- chart specification (
ChartSpec) - data adapters (SwiftData, Room, SQLDelight, API)
- shared theming tokens
- accessibility defaults
- chart interaction defaults (selection + tooltip summaries)
- viewport performance guardrails (windowing + downsampling)
- reusable chart recipes
Teams repeatedly rebuild the same mobile chart surfaces: KPI cards, trend lines, segmented bars, and dashboard widgets. This project provides a consistent, open-source foundation for iOS and Android.
- User: mobile teams using SwiftUI + Compose dashboards.
- Promise: Ship production charts from ChartSpec in under few minutes.
- Adopt existing chart engines (
Swift Charts, Compose chart libs) and add a thin reuse layer. - Keep
ChartSpecdeclarative, versioned, and portable. - Make data-source wiring explicit and testable.
- Ship accessibility and governance from day one.
packages/spec: JSON Schema and typed model forChartSpec.packages/ios-swiftui: iOS integration scaffold for SwiftUI + SwiftData.packages/android-compose: Android integration scaffold for Compose + Room.registry: reusable chart recipes.examples: end-to-end SwiftData and Room dashboard scaffolds.docs: architecture, spec guide, and project management docs.
pnpm chartcn:initRuns directly from repo source. No separate install step for first run.
No prompts. No flags. No first-run choices.
Generated output:
chartcn-starter/templates/kpi-card/chartspec.json(one example spec)chartcn-starter/screenshots/chartcn-starter-preview.svg(one screenshot output)- iOS + Android + sample data files for each starter template
Install from npm (preferred, once NPM_TOKEN is configured and a publish runs):
npm install @chartcn/specInstall from GitHub release tarball (available now):
npm install https://github.com/theamodhshetty/chartcn-mobile/releases/latest/download/chartcn-spec-latest.tgzEnable automated npm publish:
gh secret set NPM_TOKEN --repo theamodhshetty/chartcn-mobilekpi-cardtrend-linecomparison-bar
Each template includes:
chartspec.jsonsample-data.jsonios.swiftandroid.kt
- Pick a starter registry item from
registry/dashboards. - Resolve it to a concrete spec:
pnpm spec:resolve registry/dashboards/trend-line.chart.json --output ./my-chart.json- Load the spec in your platform package:
- iOS:
ChartSpecLoader.load(...)+ChartCNView(spec:rows:) - Android:
ChartSpecParser.parse(...)+ChartCNView(spec, rows)
pnpm spec:validate: schema + semantic checks on specs.pnpm spec:validate:examples: validates starter and example specs underexamples/andstarter/templates/.pnpm spec:validate:registry: validates registry entries and resolved source specs.pnpm spec:resolve -- <registry-item.json> --output <resolved.json>: resolves registry entry to a concrete spec.pnpm spec:migrate -- <file.json> --in-place: migrates spec to current runtime version.pnpm spec:compat -- <baseline.json> <candidate.json>: compatibility gate check.pnpm spec:bench -- --iterations 200 --rows 1000: runs benchmark harness for validate/migrate/compat flows.pnpm spec:build: builds distributable@chartcn/specartifacts intopackages/spec/dist.
v0.2 implementation is complete. Current work should bias toward v1.0 hardening: registry stability, compatibility guarantees, and production-ready examples/docs.
See:
ROADMAP.mdfor milestones.GOVERNANCE.mdfor roles and decision model.docs/versioning.mdfor spec versioning/migration.docs/performance.mdfor benchmark harness and baseline capture.docs/release-strategy.mdfor OSS release process.docs/go-to-market.mdfor launch and adoption plan.docs/announcement-template.mdfor future release announcements.