Bengali Digit Support
The application recognizes and processes Bengali numerals (০ ১ ২ ৩ ৪ ৫ ৬ ৭ ৮ ৯) in addition to standard Latin digits (0-9).Digit Mapping
Two mapping objects handle conversion between Bengali and Latin numerals:Input Normalization
When users enter data, Bengali numerals are automatically converted to Latin numerals for internal processing:- Converts Bengali digits (০-৯) to Latin digits (0-9)
- Removes percentage symbols (% and ٪)
- Removes thousand separators (٬ and ,)
- Converts Arabic decimal separator (٫) to period (.)
- Normalizes various dash characters to minus sign (-)
The normalization function supports multiple numeral systems and formatting conventions, making the application accessible to diverse user bases.
Number Parsing
After normalization, the string is parsed into a JavaScript number:- Empty strings
- Lone minus signs
- Lone decimal points
- Incomplete negative decimals
Converting to Bengali
When displaying numbers that were originally entered in Bengali, they are converted back:Chart Number Formatting
Numbers are formatted for display on charts with optional Bengali numeral conversion:- Returns empty string for non-finite numbers (NaN, Infinity)
- Formats integers as-is
- Formats decimals to 2 decimal places, removing trailing “.0”
- Converts to Bengali numerals if requested
Format Examples
- Latin Numerals
- Bengali Numerals
Tracking Input Language
The validation system detects whether Bengali numerals were used in the input:/[০-৯]/ checks if the input contains any Bengali digits. This boolean flag is stored with each data row.
Chart Display
Bengali numerals are used in multiple chart contexts:1. Tooltips
Tooltips show values in the same numeral system used for input:2. Value Labels
On-chart value labels respect the input language for each data point:3. Y-Axis (Bar Charts)
For bar charts, the Y-axis uses Bengali numerals only if ALL data points were entered in Bengali:The axis uses Bengali numerals only when ALL values were entered in Bengali. This prevents mixing numeral systems on a single axis, which would be confusing.
Mixed Input Handling
Users can enter some values in Bengali and others in Latin numerals within the same chart:useBengaliNumeralsByIndex array tracks which specific data points should display in Bengali.
Font Support
The application ensures Bengali numerals render correctly by including appropriate fonts:- Inter - Modern sans-serif (primary interface font)
- Segoe UI - Windows system font
- system-ui - Platform default
- -apple-system - macOS/iOS default
- Noto Serif Bengali - Google font with excellent Bengali support
- Nirmala UI - Windows font with Indic script support
- sans-serif - Generic fallback
Use Cases
Bengali-Speaking Classrooms
Teachers working with Bengali-speaking students can:- Enter data directly in Bengali numerals
- Generate charts that display values in familiar numerals
- Export charts for Bengali-language materials
Mixed Language Environments
- Students can use whichever numeral system they’re comfortable with
- Data entered in Bengali displays in Bengali
- Data entered in Latin displays in Latin
- No manual conversion required
International Education
- Support for diverse student populations
- Respect for linguistic preferences
- Automatic handling reduces errors
While Simple Charts currently implements Bengali numerals specifically, the architecture could be extended to support other numeral systems like Arabic-Indic, Devanagari, or Persian numerals.
Edge Cases Handled
- Mixing numeral systems in one input: Normalized to Latin internally
- Empty Bengali input: Handled as NaN, triggers validation error
- Decimal numbers in Bengali: Decimal point remains as ”.” (not converted)
- Negative Bengali numbers: Minus sign supported with any numeral system
- Percentage symbols with Bengali: Symbol stripped, numerals converted
Implementation Notes
- Bengali detection uses regex:
/[০-৯]/ - Conversion is lossless (no rounding during conversion)
- Display format honors the input language per data point
- Axis format uses Bengali only when ALL inputs are Bengali
- Validation works identically regardless of numeral system used