@@ -136,18 +136,26 @@ gridDashedLine: {
136136
137137## Value Formatters
138138
139- ### Built-in Formatters
139+ ` valueFormatter ` accepts either a ` string[] ` (category labels) or one of the named
140+ formatters described below. The runtime resolves it to a native formatter
141+ (` ChartIndexAxisValueFormatter ` on iOS, ` IndexAxisValueFormatter ` on Android) and
142+ applies it to the underlying chart axis.
143+
144+ ### Custom Labels Array (recommended)
145+
146+ Map each integer x-value to a category label by index. This is what powers
147+ horizontal bar charts that show category names on the value axis.
140148
141149``` typescript
142- valueFormatter : ' largeValue' // 1000 → 1K, 1000000 → 1M
143- valueFormatter : ' percent' // 0.5 → 50%
144- valueFormatter : ' date' // Uses valueFormatterPattern
150+ valueFormatter : [' Jan' , ' Feb' , ' Mar' , ' Apr' , ' May' , ' Jun' ]
145151```
146152
147- ### Custom Labels Array
153+ ### Built-in Named Formatters
148154
149155``` typescript
150- valueFormatter : [' Jan' , ' Feb' , ' Mar' , ' Apr' , ' May' , ' Jun' ]
156+ valueFormatter : ' largeValue' // 1000 → 1K, 1000000 → 1M
157+ valueFormatter : ' percent' // 0.5 → 50%
158+ valueFormatter : ' date' // Uses valueFormatterPattern
151159```
152160
153161### Date Formatting
@@ -168,6 +176,45 @@ valueFormatterLabels: [
168176],
169177```
170178
179+ ### Support Matrix
180+
181+ | Formatter | iOS | Android |
182+ | ----------------- | --------------------------------------------------- | --------------------------------------------- |
183+ | ` string[] ` | ✅ ` ChartIndexAxisValueFormatter ` | ✅ ` IndexAxisValueFormatter ` |
184+ | ` 'largeValue' ` | ✅ ` ChartDefaultAxisValueFormatter ` (block) | ✅ ` LargeValueFormatter ` (built-in) |
185+ | ` 'percent' ` | ✅ ` NSNumberFormatter ` (PercentStyle) via block | ✅ ` PercentFormatter ` (built-in) |
186+ | ` 'date' ` | ✅ ` NSDateFormatter ` w/ ` valueFormatterPattern ` | ✅ ` SimpleDateFormat ` w/ ` valueFormatterPattern ` |
187+ | ` 'labelByXValue' ` | ✅ Sparse lookup via ` valueFormatterLabels ` | ✅ Sparse lookup via ` valueFormatterLabels ` |
188+
189+ If an unrecognized string is passed, the chart silently falls back to the
190+ platform default (numeric labels). The single entry points are
191+ ` resolveAxisValueFormatterIOS ` in
192+ ` packages/ncharts/charts/style-helpers.ios.ts ` and
193+ ` resolveAxisValueFormatterAndroid ` in
194+ ` packages/ncharts/charts/style-helpers.android.ts ` — both are unit-tested in
195+ their adjacent ` *.spec.ts ` files.
196+
197+ #### Platform notes
198+
199+ - ** ` 'percent' ` ** — the value passed to the axis is treated as the * percentage
200+ itself* (e.g. ` 50 ` → ` "50%" ` ), not a 0–1 fraction. On iOS we divide by 100
201+ before handing to ` NSNumberFormatter ` so both platforms agree.
202+ - ** ` 'date' ` ** — iOS interprets the value as ** epoch seconds** (` NSDate `
203+ convention); Android interprets it as ** epoch milliseconds** (` java.util.Date `
204+ convention). If you want a single value to format identically on both, scale
205+ it accordingly before plotting.
206+ - ** ` 'labelByXValue' ` ** — when no entry in ` valueFormatterLabels ` matches the
207+ current axis value, both platforms fall back to the raw numeric value.
208+
209+ ### Chart-Type Coverage
210+
211+ The ` applyXAxisIOS / applyXAxisAndroid ` and ` applyYAxisIOS / applyYAxisAndroid `
212+ helpers apply ` valueFormatter ` for every chart that goes through the shared axis
213+ pipeline: ` BarChart ` , ` HorizontalBarChart ` , ` LineChart ` , ` ScatterChart ` ,
214+ ` BubbleChart ` , ` CandleStickChart ` , and ` CombinedChart ` . ` RadarChart ` uses a
215+ chart-data-level path instead (` data.labels ` rather than ` xAxis.valueFormatter ` );
216+ see [ Radar Chart] ( ../charts/radar-chart.md ) for the radar-specific API.
217+
171218## Limit Lines
172219
173220Add reference lines to your axes:
0 commit comments