'Plot Plotly chart with german date values

I recently started working with xslt to generate html from a given xml document. I am trying to display history values using plotly, which is already working well.

Nevertheless, I am currently facing a problem: The x-axis with the date values should be displayed in German. I have already tried to set locale to 'de_DE', but unfortunately this does not work. Does anyone have any idea of how it might work?

var myPlot = node.children[0];
trace1 = {
  x: values.map(a => a.xvalue),
  y: values.map(a => a.yvalue),
  type:'scatter',
  name:'Messung',
  locale:'de_DE',
  hovertemplate: '<b>Wert:</b> %{y}<br><b>Datum:</b> %{x}<br>'
};
data = [ trace1 ];
layout = {
  title: 'Verlaufswert: ' + vitSigTitle,
  hovermode:'closest',
  xaxis: {
    autorange: true,
    range: [beginDate, endDate],
    rangeselector: {
      buttons: [
        {
          count: 1,
          label: 'Monat',
          step: 'month',
          stepmode: 'backward'
        },
        {
          count: 6,
          label: '6 Monate',
          step: 'month',
          stepmode: 'backward'
        },
        {
          count: 1,
          label: 'Jahr',
          step: 'year',
          stepmode: 'backward'
        },
        {
          count: 1,
          label: 'Day',
          step: 'day',
          stepmode: 'backward'
        },
        { step: 'all' },
      ]
    },
    rangeslider: {range: [beginDate, endDate]},
    type: 'date'
  },
  yaxis: {
    title: vitSigUnit,
    autorange: false,
    range: [minValue-10, maxValue+10],
    type: 'linear',
    locale:'de_DE'
  }
};

Plotly.newPlot(node.children[0], data, layout, {locale: 'de-DE'});
console.log(Plotly.BUILD);


Solution 1:[1]

Just setting the locale is not enough, you also have to include the corresponding js file, see https://github.com/plotly/plotly.js/blob/master/dist/README.md#to-include-localization

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mit