Pivottable with Plotly – Can’t set Locale

  angular, javascript, pivottable.js, plotly

I am using Pivottable.js with Plotly and I need to set the locale for my country.

As said on Pivot Table Documentation, I need to use the rendererOptions object with plotlyConfig object to override the config object from Plotly.

As described on Plotly set Locale Documentation, I have import the Language Pack and set the "locale" property to my desired locale.

So, I have the following pivotUI call:

let obj = targetElement.pivotUI(
      this.data, 
      {
        renderers: renderers,
        rendererOptions: {
          plotlyConfig: {
            locale: "pt"
          }
        }
      },
      false,
      "pt"
    )

And in my HTML header I have the following:

<head>
  <meta charset="utf-8">
  <title>My app title</title>
  <base href="/">
  <!-- Other scripts -->

  https://cdn.plot.ly/plotly-basic-latest.min.js
  https://cdn.plot.ly/plotly-locale-pt-br-latest.js  
</head>

But it doesn’t work. The select menu still displaying in default English locale.

I’m using this pivottable.js plugin in Angular 8.

Is there anything else that I should do?

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.