Skip to content

feat: add chart component#82

Open
V3RON wants to merge 7 commits intomainfrom
feat/charts
Open

feat: add chart component#82
V3RON wants to merge 7 commits intomainfrom
feat/charts

Conversation

@V3RON
Copy link
Contributor

@V3RON V3RON commented Feb 13, 2026

Add chart components for iOS and Android widgets and Live Activities, including bar, line, area, point, rule, and pie/donut charts.

@vercel
Copy link

vercel bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
voltra Ready Ready Preview, Comment Mar 10, 2026 2:24pm

Request Review

## Android Chart Implementation

Implements the Android counterpart to the iOS `Chart` component added in
`feat/charts`. Supports bar, line, area, point, rule, and sector
(pie/donut) mark types inside Glance widgets.

### Approach

Jetpack Glance has no charting API, so charts are rendered to a `Bitmap`
via Android `Canvas` and displayed as a Glance `Image` using
`Icon.createWithBitmap()`.

- `ChartBitmapRenderer.kt` — core Canvas drawing engine for all 6 mark
types, axes, grid lines, labels, and color palette
- `ChartRenderers.kt` — Glance composable that reads style/props,
renders the bitmap, and outputs an `Image`
- `ChartParameters.kt` — generated parameter model

Chart dimensions come from the `style` prop. Bitmaps are capped at 600px
to stay within RemoteViews parcel limits.

### TypeScript

- `VoltraAndroid.Chart` and mark components (`BarMark`, `LineMark`,
`AreaMark`, `PointMark`, `RuleMark`, `SectorMark`) in the Android
namespace
- Shares types and wire format with the iOS `Voltra.Chart` from
`feat/charts`

### Example app

- `AndroidChartWidget.tsx` — 4 widget variants (bar, line, area, pie)
- `AndroidChartScreen.tsx` — interactive preview with chart type and
size selectors

| Bar | Line | Area | Pie |
|--------|--------|--------|--------|
| <img width="329" height="623" alt="image"
src="https://github.com/user-attachments/assets/5049fb8b-32ed-4841-86a3-90be3676bad7"
/> | <img width="327" height="623" alt="image"
src="https://github.com/user-attachments/assets/bb85976b-df57-4a97-980a-678b77308db6"
/> | <img width="330" height="624" alt="image"
src="https://github.com/user-attachments/assets/96e2e24e-4b05-4b40-a921-51173c81c5b6"
/> | <img width="326" height="621" alt="image"
src="https://github.com/user-attachments/assets/e90d94e7-8fb9-413d-a251-aca52e468c17"
/> |
- Widget registered as `chart_widget` in `app.json` with initial state
V3RON added 3 commits March 10, 2026 15:26
# Conflicts:
#	example/app.json
#	example/screens/android/AndroidScreen.tsx
#	example/screens/testing-grounds/TestingGroundsScreen.tsx
#	ios/ui/Style/JSColorParser.swift
#	plugin/src/ios-widget/index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants