Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
## 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
# 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add chart components for iOS and Android widgets and Live Activities, including bar, line, area, point, rule, and pie/donut charts.