layerchart
layerchart copied to clipboard
Intl support
Under the hood, LayerChart uses LayerStack's format util to format dates and numbers.
We have plans to add a settings() context similar to Svelte UX to control this globally (as well as setting default props and global styling refinements).
Until settings is added, you can override the defaultLocale exported from @layerstack/utils
import { createLocaleSettings, defaultLocale } from '@layerstack/utils';
export function localizeLayerChart() {
Object.assign(
defaultLocale,
createLocaleSettings({
locale: 'es',
formats: { ... }
})
)
}
You can also format on a per-chart / component basis:
<script>
import { format } from '@layerstack/utils';
</script>
<Axis format={x => format(x, { locale: 'es' })} />