Creates a new FormatterService from MAIDR data. Extracts format configurations from all layers and resolves format functions.
The MAIDR data containing layers with optional format configs
Gets the format function for a specific layer and axis.
The ID of the layer
The axis type ('x', 'y', or 'fill')
The format function, or defaultFormat if not found
Checks if a layer has a custom formatter for the specified axis.
The ID of the layer
The axis type ('x', 'y', or 'fill')
True if a custom formatter is configured
Formats a value (single or array) using the formatter for the specified layer and axis.
This is the primary method for formatting values in the application. It handles both single values and arrays (e.g., boxplot outliers).
The value or array of values to format
The ID of the layer
The axis type ('x', 'y', or 'fill')
Formatted string or array of formatted strings
Formats a single value (not an array) and always returns a string. Use this when you're certain the value is not an array.
The single value to format
The ID of the layer
The axis type ('x', 'y', or 'fill')
Formatted string
Formats an array of values and always returns a string array. Use this when you're certain the value is an array.
The array of values to format
The ID of the layer
The axis type ('x', 'y', or 'fill')
Array of formatted strings
Releases resources held by the service.
Service for managing value formatting across all layers in a MAIDR figure.
The FormatterService extracts format configurations from layer definitions and provides methods to format values consistently throughout the application.
Example