Hi,
I'm having this issue of plotting comma separated currency value in ui5 bar chart (vizframe)..I'm getting the value from oData as big decimal (for example - 123456.000) which I need to convert to format (1,23,456.000) and put the same into graph.
I'm able to convert big decimal into comma separated string with same required format but while trying to put this same formatted string in vizframe graph, it's not coming in graph.
Help would be appreciated. Here is the code what I've written inside. I've used formatter function to convert big decimal to string and then setting the same to measure.
var oDataset = new FlattenedDataset({
dimensions: [
{
name: 'XXXX',
value: "{graphData>matname}"
},
],
measures: [{
name: GraphTitle,
// value: '{graphData>TotalValue}'
value: {
path: "graphData>TotalValue",
formatter: function(fValue) {
if(fValue){
//alert(fValue);
var x=fValue.toString();
var afterPoint = '';
if(x.indexOf('.') > 0)
afterPoint = x.substr(x.indexOf('.'),x.length);
x = Math.floor(x);
x=x.toString();
var lastThree = x.substr(x.length-3);
var otherNumbers = x.substr(0,x.length-3);
if(otherNumbers != '')
lastThree = ',' + lastThree;
var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree + afterPoint;
var mm = parseFloat(res);
return res;
} else {
return fValue;
}
}
}
},
],
data: {
path: "graphData>/results"
}
});
oVizFrame.setDataset(oDatase
Cheers,
Sen