Pivottable with Plotly - Can't set Locale

693 Views Asked by At

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 -->

  <script src="https://cdn.plot.ly/plotly-basic-latest.min.js"></script>
  <script src="https://cdn.plot.ly/plotly-locale-pt-br-latest.js"></script>  
</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?

1

There are 1 best solutions below

0
Niels Schroyen On

You are using https://cdn.plot.ly/plotly-locale-pt-br-latest.js, wich has the languagename name:"pt-BR". So you should use locale: "pt-BR".