PHPackages                             donmanueldev/nativephp-charts - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. donmanueldev/nativephp-charts

ActiveNativephp-ui-plugin

donmanueldev/nativephp-charts
=============================

Native chart components for NativePHP Mobile, rendered with SwiftUI and Jetpack Compose.

v0.2.0(today)02↑2900%[1 issues](https://github.com/donmanueldev/nativephp-charts/issues)MITPHPPHP ^8.2CI failing

Since Aug 27Pushed todayCompare

[ Source](https://github.com/donmanueldev/nativephp-charts)[ Packagist](https://packagist.org/packages/donmanueldev/nativephp-charts)[ RSS](/packages/donmanueldev-nativephp-charts/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (3)Used By (0)

NativePHP Charts
================

[](#nativephp-charts)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7dc46b971d9113704d537018afb9d1fcad5c7fa1c26231329486946c02279921/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f6e6d616e75656c6465762f6e61746976657068702d6368617274732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/donmanueldev/nativephp-charts)[![Total Downloads](https://camo.githubusercontent.com/40589647e9fe6ac3404720b9414b072a314efed1c4d788e01370f1a86ea4f1ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646f6e6d616e75656c6465762f6e61746976657068702d6368617274732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/donmanueldev/nativephp-charts)[![PHP Version](https://camo.githubusercontent.com/3dbcb55da5a5d7b8df7735202b769205053aaabf8e3a28ab2fb8344676772fb7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f646f6e6d616e75656c6465762f6e61746976657068702d6368617274732f7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/donmanueldev/nativephp-charts)[![License](https://camo.githubusercontent.com/5e96c7c47e550aa2b145813a144df9c7d8e3b7429dc956080260a6a67f5a2acd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f646f6e6d616e75656c6465762f6e61746976657068702d6368617274732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/donmanueldev/nativephp-charts)

Native line and bar charts for [NativePHP Mobile](https://nativephp.com), rendered with Swift Charts on iOS and Jetpack Compose on Android. Chart data stays in the app and is rendered by native platform primitives—there is no WebView, JavaScript charting library, or remote rendering service.

> NativePHP Charts is an independent community plugin. It is not an official NativePHP package.

Features
--------

[](#features)

- Real native `LineChart` and `BarChart` components for SuperNative/EDGE views.
- One ordered data series with stable identity and numeric points.
- Positive, zero, negative, decimal, and single-point domains.
- Device-aware number, currency, and percentage formatting.
- BCP-47 locale support and configurable fraction digits.
- Light and dark appearance using native platform colors.
- Empty states, optional animation, grid and axis controls.
- VoiceOver and TalkBack summaries from the same authoritative chart data.
- Bar selection tooltips without introducing JavaScript or selection callbacks.
- No permissions, secrets, telemetry, network access, or third-party native dependencies.

What is new in v0.2.0
---------------------

[](#what-is-new-in-v020)

- Added the public `` EDGE component.
- Added Swift Charts and Jetpack Compose bar renderers.
- Added categorical, mixed-sign currency, and percentage support for bars.
- Added localized tap tooltips for bar values.
- Preserved the existing LineChart Blade and fluent PHP contracts.
- Corrected non-zero single-point LineChart domains to use relative padding on both platforms.
- Ensured iOS empty BarChart states announce their configured empty label.
- Made Android BarChart precision changes invalidate and rebuild the native formatter.
- Expanded manifest, contract, catalogue, renderer, accessibility, and release regression coverage.

Requirements
------------

[](#requirements)

RequirementSupportedPHP`^8.2`NativePHP Mobile`^4.0`AndroidAPI 26 or neweriOS18.2 or newerNativePHP DesktopNot supportedWebView / browser renderingNot supportedThe package is a NativePHP UI component plugin. It does not expose bridge functions, events, permissions, services, or background tasks.

Installation
------------

[](#installation)

Install the package from [Packagist](https://packagist.org/packages/donmanueldev/nativephp-charts):

```
composer require donmanueldev/nativephp-charts:^0.2
```

Publish the application's native plugin provider, register the package explicitly, and verify registration:

```
php artisan vendor:publish --tag=nativephp-plugins-provider --no-interaction
php artisan native:plugin:register donmanueldev/nativephp-charts --no-interaction
php artisan native:plugin:list
php artisan native:plugin:validate
```

Registration is required. Composer auto-discovery loads the PHP package, but NativePHP does not compile the Swift and Kotlin renderers into the app until the plugin is registered.

Finally, rebuild the platform you are developing for:

```
php artisan native:run ios
```

or:

```
php artisan native:run android
```

Native source is compiled at build time. A PHP hot reload cannot install or replace the native renderers.

Updating
--------

[](#updating)

Update the Composer package, confirm it remains registered, validate the manifest, and rebuild the affected native target:

```
composer update donmanueldev/nativephp-charts
php artisan native:plugin:list
php artisan native:plugin:validate
```

If a NativePHP shell generated before the update still contains stale plugin files, regenerate it with `php artisan native:install --force`, then rebuild the selected platform.

Quick start
-----------

[](#quick-start)

Use charts inside a `NativeComponent` EDGE view. Each chart is a leaf element and must have an explicit width and height.

### Line chart

[](#line-chart)

```

```

### Bar chart

[](#bar-chart)

```

```

Bar charts display a local tooltip when a category is tapped. This is presentation-only and does not emit a PHP callback.

Data contract
-------------

[](#data-contract)

`series` must be an ordered array containing zero or one series. Passing more than one series throws an `InvalidArgumentException` instead of silently dropping data.

```
[
    [
        'id' => 'stable-series-id',
        'name' => 'Human-readable series name',
        'color' => '#0F766E',
        'points' => [
            ['label' => 'First', 'value' => 12],
            ['label' => 'Second', 'value' => 18.5],
        ],
    ],
]
```

FieldTypeRules`series[].id``string`Required, non-empty, and stable across updates.`series[].name``string`Required, non-empty, and included in accessibility summaries.`series[].color``string`Required supported color.`series[].points`ordered arrayRequired; may be empty.`points[].label``string`Required and non-empty.`points[].value``int|float`Required and finite; numeric strings are rejected.Keep the series `id` stable when points change so native updates and animations retain the same logical identity.

Properties
----------

[](#properties)

Blade propertyDefaultDescription`series``[]`Zero or one ordered series using the contract above.`show-grid``true`Shows or hides grid lines.`show-points``true`Shows LineChart point markers; on BarChart it controls axis ticks and labels.`begin-at-zero``true`Includes zero in the numeric domain.`animated``true`Enables the initial native animation.`empty-label``No data`Visible and accessible text for an empty series.`a11y-label``Chart`Purpose of the chart announced by VoiceOver or TalkBack.`locale`Device localeBCP-47 locale such as `es-NI` or `en-US`.`value-format``number``number`, `currency`, or `percent`.`currency-code`NoneRequired three-letter ISO 4217 code for currency values.`minimum-fraction-digits`Formatter defaultInteger from 0 to 8.`maximum-fraction-digits`Formatter defaultInteger from 0 to 8 and not lower than the minimum.`style``[]`Platform-neutral LineChart style configuration described below.Blade accepts the documented kebab-case property names. The fluent PHP API uses camelCase methods such as `showGrid()`, `beginAtZero()`, `valueFormat()`, and `maximumFractionDigits()`.

### Percent values

[](#percent-values)

Use fractional values for percentages. For example, `0.92` is formatted as `92%`; do not pass `92` unless `9,200%` is the intended value.

LineChart styling
-----------------

[](#linechart-styling)

The `style` contract currently applies to LineChart. Values in `style.points.visible` and `style.grid.visible` take precedence over the corresponding scalar toggles.

```
:style="[
    'line' => [
        'color' => '#7C3AED',
        'width' => 3,
        'interpolation' => 'smooth',
    ],
    'points' => [
        'visible' => true,
        'color' => '#FFFFFF',
        'size' => 5,
    ],
    'grid' => [
        'visible' => true,
        'color' => '#E2E8F0',
        'width' => 1,
    ],
    'axis' => [
        'visible' => true,
        'color' => '#94A3B8',
        'labelColor' => '#475569',
        'font' => 'accent',
        'fontSize' => 11,
        'labelCount' => 4,
    ],
]"
```

SectionOptions`line``color`, `width` greater than 0 and at most 16, `interpolation` as `linear` or `smooth``points``visible`, `color`, `size` greater than 0 and at most 24`grid``visible`, `color`, `width` greater than 0 and at most 8`axis``visible`, `color`, `labelColor`, `font`, `fontSize` greater than 0 and at most 32, `labelCount` from 2 to 8Unsupported sections or options are rejected explicitly.

BarChart v0.2 uses `series.color` for bars and the scalar `show-grid` / `show-points` controls. Bar-specific `style` overrides are not rendered yet.

### Colors

[](#colors)

Supported colors are:

- `#RGB`
- `#RRGGBB`
- CSS alpha `#RRGGBBAA`
- `black`
- `white`
- `transparent`

CSS alpha values are normalized internally to the native ARGB wire format. Tailwind palette names and arbitrary CSS color functions are not accepted as data colors.

### Fonts

[](#fonts)

`style.axis.font` accepts a bundled NativePHP font filename without its extension or a font alias configured by the host app. Unresolved fonts safely fall back to the platform system font.

Fluent PHP API
--------------

[](#fluent-php-api)

The same contract is available when constructing an element programmatically:

```
use Donmanueldev\NativephpCharts\Elements\LineChart;

$chart = LineChart::make()
    ->series($series)
    ->showGrid(true)
    ->showPoints(true)
    ->beginAtZero(false)
    ->animated(true)
    ->locale('en-US')
    ->valueFormat('percent')
    ->minimumFractionDigits(1)
    ->maximumFractionDigits(1)
    ->a11yLabel('Service availability by month');
```

Use `Donmanueldev\NativephpCharts\Elements\BarChart` for the bar wire type.

Accessibility
-------------

[](#accessibility)

Every production chart should provide an `a11y-label` that describes its purpose, not its visual appearance.

```
a11y-label="Monthly revenue in Nicaraguan córdobas"
```

Both native renderers expose:

- The supplied purpose as the accessibility label.
- The localized series name, point labels, and formatted values as the accessibility value/description.
- The `empty-label` when there are no points.

Keep series names, point labels, `a11y-label`, and `empty-label` in the application's language. Do not include secrets or unnecessary personal data in chart labels because screen readers announce the textual summary.

Dynamic updates
---------------

[](#dynamic-updates)

Charts re-render when their serialized series or configuration changes. Keep `series[].id` stable, preserve point order, and update the values rather than generating a new random identity on each render.

Native renderer changes still require a native rebuild; ordinary PHP data changes can use the normal NativePHP development loop.

Security and privacy
--------------------

[](#security-and-privacy)

NativePHP Charts has a deliberately small operational surface:

- No Android permissions or iOS entitlements.
- No secrets or environment variables.
- No analytics, telemetry, logging, or remote requests.
- No bridge functions or background services.
- No Gradle, CocoaPods, or Swift Package dependencies.
- No JavaScript runtime or WebView integration.

Chart values are serialized by the host app and consumed locally by the native renderer. Applications remain responsible for authorizing and minimizing the data they choose to display.

To report a security issue, do not open a public issue containing exploit details or sensitive data. Email `donmanuel@momotombo.dev` with the affected version, platform, impact, and a minimal reproduction.

Troubleshooting
---------------

[](#troubleshooting)

### The chart renders nothing

[](#the-chart-renders-nothing)

- Confirm the chart is inside a `NativeComponent` view.
- Give it an explicit height such as `class="w-full h-72"`.
- Run `php artisan native:plugin:list` and verify `donmanueldev/nativephp-charts` is registered.
- Rebuild the platform after installing or updating the package.

### NativePHP reports that the plugin is installed but not registered

[](#nativephp-reports-that-the-plugin-is-installed-but-not-registered)

Run:

```
php artisan native:plugin:register donmanueldev/nativephp-charts --no-interaction
php artisan native:plugin:list
```

### `native:plugin:validate` warns about `bridge_functions`

[](#nativepluginvalidate-warns-about-bridge_functions)

`No bridge_functions defined in manifest` is expected. This package exposes native UI components only and does not call native functions from PHP.

### Currency rendering fails during PHP serialization

[](#currency-rendering-fails-during-php-serialization)

Set `currency-code` whenever `value-format="currency"` is used. The code must contain exactly three letters, for example `USD` or `NIO`.

### The app still uses an older renderer after updating

[](#the-app-still-uses-an-older-renderer-after-updating)

Native files are compiled into the application binary. Regenerate the native shell with `php artisan native:install --force` when needed, then rebuild the selected platform.

Verified release evidence
-------------------------

[](#verified-release-evidence)

The v0.2.0 release candidate was verified on 2026-08-28 with:

- 39 focused package and laboratory tests passing with 232 assertions.
- `composer validate --strict` passing.
- Laravel Pint passing for changed PHP files.
- `native:plugin:validate` completing with no errors and the expected UI-only warning.
- Swift source parsing and an iOS simulator Xcode build succeeding.
- The Android debug APK building, installing, and rendering on the available emulator.
- LineChart and BarChart light/dark, signed values, locale formatting, tooltips, and accessibility checks on both native targets.
- The LineChart `99.8%` single-point case remaining centered by relative domain padding on both platforms.

Native acceptance environments:

TargetVerified environmentStatusiOS simulatoriPhone 17, iOS 26.5PassedAndroid emulatorPixel 10 Pro profile, Android API 37PassedPhysical iOS deviceNot exercisedPendingPhysical Android deviceNot exercisedPendingSimulator and emulator evidence proves native compilation and renderer behavior in those environments. It does not claim physical-device acceptance.

Current limitations
-------------------

[](#current-limitations)

- Zero or one series is supported; multiple series and legends are not rendered.
- BarChart `style` sections are serialized for contract compatibility but are not applied by the v0.2 native bar renderers.
- Bar tooltips do not emit PHP selection callbacks.
- Zooming, scrolling, date-specific axes, stacked bars, area, pie, and donut charts are not included.
- Physical-device acceptance is not yet recorded.
- NativePHP Desktop, browser, WebView, and JavaScript rendering are outside this package's scope.

Support
-------

[](#support)

Use [GitHub Issues](https://github.com/donmanueldev/nativephp-charts/issues) for reproducible bugs and focused feature requests. Include:

- Package and NativePHP Mobile versions.
- iOS or Android version and simulator, emulator, or physical-device model.
- A minimal `series` payload and Blade snippet.
- Expected and actual behavior.
- A screenshot or accessibility output when relevant.
- Any `native:plugin:validate` or build error without secrets.

Development and contributing
----------------------------

[](#development-and-contributing)

Clone the repository, install development dependencies, and run the package tests:

```
git clone https://github.com/donmanueldev/nativephp-charts.git
cd nativephp-charts
composer install
composer test
```

Contributions should preserve the platform-neutral PHP/Blade contract, include focused regression coverage, and keep the Swift and Kotlin behavior aligned. Native renderer changes are not considered verified until the affected generated project compiles; visual or accessibility changes should also include simulator, emulator, or device evidence.

Open an issue before proposing a breaking public-contract change or a new chart type so its cross-platform behavior and release scope can be agreed first.

Versioning
----------

[](#versioning)

Releases use Git tags and are distributed through [Packagist](https://packagist.org/packages/donmanueldev/nativephp-charts). The package is pre-1.0: minor releases may refine the API, while patch releases are reserved for backwards-compatible fixes. Pin a compatible range such as `^0.2` and review release notes before upgrading to a new minor version.

Release history
---------------

[](#release-history)

### v0.2.0

[](#v020)

- Added native BarChart support on iOS and Android.
- Added bar tooltips, signed domains, localized values, and accessibility summaries.
- Corrected LineChart non-zero single-point domain padding.
- Corrected the iOS empty-state accessibility value and Android formatter reactivity.
- Expanded contract and native release validation.

### v0.1.0

[](#v010)

- Introduced the single-series native LineChart.
- Added localized number formatting, semantic styles, dark mode, empty states, animation, and accessibility summaries.

License
-------

[](#license)

NativePHP Charts is open-source software licensed under the MIT license.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance100

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46093689?v=4)[Manuel Duarte 🌋](/maintainers/donmanueldev)[@donmanueldev](https://github.com/donmanueldev)

---

Top Contributors

[![donmanueldev](https://avatars.githubusercontent.com/u/46093689?v=4)](https://github.com/donmanueldev "donmanueldev (7 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/donmanueldev-nativephp-charts/health.svg)

```
[![Health](https://phpackages.com/badges/donmanueldev-nativephp-charts/health.svg)](https://phpackages.com/packages/donmanueldev-nativephp-charts)
```

###  Alternatives

[nativephp/mobile-starter

The skeleton application for NativePHP for Mobile.

233.0k](/packages/nativephp-mobile-starter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
