Hello Helical Insight,
I am using helical insight version 4.1 GA. I want to Format the data labels for bar chart and the value of card with thousand separator as well as add $ in front of it.
Thank you,
Netta.
Hello Helical Insight,
I am using helical insight version 4.1 GA. I want to Format the data labels for bar chart and the value of card with thousand separator as well as add $ in front of it.
Thank you,
Netta.
Hello Netta,
We have written some custom JS script for this. Please find below the same. You need to inject this at report level in JS Editor.
To add $ sign and values extend to 2 decimals for datalables in barchart :
hi_container.set("preExecution",function(c){
var viz_Options = c.get("viz_Options");
viz_Options.chartOptions["data"] = {
labels: {
format: function(value, ratio, id) {
return '$' + value.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}
}
};
c.set("viz_Options",viz_Options);
});
For the card :
hi_container.set("postFetch",function(c){
var responseData = c.get("responseData");
let valName = Object.getOwnPropertyNames(responseData.data[0])[0];
responseData.data[0][valName] = '$' + responseData.data[0][valName].toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
c.set("responseData",responseData);
});
Here you can edit the returned value based on your requirements.
Thank you,
Helical Insight.