用 D3 中轴上的逗号替换小数点?

Replace the decimal dot with a comma on an axis in D3?

这是关于D3中轴上的刻度:有没有办法用数字中的逗号替换小数点?我希望数字这样显示(这在德国很正常,这么大的数字只是为了演示)

1.000.000,1 // This is one million and a tenth

而不是这样:

1,000,000.1

我已经阅读了关于该主题的documentation,但似乎没有可能!?到目前为止,这是我的相关代码:

localeFormatter = d3.locale({
                "decimal": ".",
                "thousands": ",",
                "grouping": [3],
                "currency": ["", "€"],
                "dateTime": "%a, %e %b %Y, %X",
                "date": "%d.%m.%Y",
                "time": "%H:%M:%S",
                "periods": ["", ""],
                "days": ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
                "shortDays": ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
                "months": ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"],
                "shortMonths": ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"]
            });


numberFormat = localeFormatter.numberFormat("04.,"); // The setting is applied, but has not the desired effect...

yAxis = d3.svg.axis()
                .scale(y)
                .orient("left")
                .tickFormat(numberFormat);

d3.locale 使用以下设置:

var localeFormatter = d3.locale({
      "decimal": ",",
      "thousands": ".",
      ...
    });

请注意,我已经更改了 , 中的 .,反之亦然。并且:

var numberFormat = localeFormatter.numberFormat(",.2f"); 

我使用千位分隔符 ,(它使用区域设置中定义的 .)和逗号后的两位数 .2f:

打印数字
console.log(numberFormat(1000000.1)); // "1.000.000,10"