How to set D3 locale currency format (€) in charts? €

Hello @Jesse_Klotz ,
Welcome to Retool Community,

First, please check the Retool Library to verify if the D3.js library is loaded. If it is not, you can load the D3.js library using the following link:

https://d3js.org/d3.v5.min.js

image

Once the library is successfully loaded, update your JavaScript query


const locale = d3.formatLocale({
  decimal: ".",
  thousands: ",",
  grouping: [3],
  currency: ["€", ""]
});

// Create a format function using the custom locale
const formatCurrency = locale.format("$.2f");

const formattedValue = formatCurrency(1234567.89);  // Example value
return formattedValue;
3 Likes