apexcharts / ng-apexcharts

ng-apexcharts is an implementation of apexcharts for angular. It comes with one simple component that enables you to use apexcharts in an angular project.
MIT License
329 stars 81 forks source link

How to set locale? #357

Closed julianpoemp closed 2 months ago

julianpoemp commented 2 months ago

I tried to set localization for a chart. There is no @Input attribute to define the locales option and no defaultLocale option. Setting a locale using setLocale()method doesn't work either because the language wasn't defined.

I tried:

import * as de from 'apexcharts/dist/locales/de.json';

// ...
this.chart!.updateOptions({
  ...this.chartOptions,
  locales: [de],
  defaultLocale: 'de',
});
this.chart!.chart.defaultLocale = "de";
this.chart!.setLocale("de");
},

// ...
julianpoemp commented 2 months ago

my bad, I missed that "locales" and "defaultLocale" options are part of the @Input chart options. Changing the locale using setLocaledoesn't work, but changing the defaultLangauge and apply updateOptions()again, works.