3 weeks ago
I have a bar chart with distinct count, i want to show percent of total, when i choose percentage it multiplies it by 100, is there a solution?
Request clarification before answering.
Try this
var oVizFrame = new sap.viz.ui5.controls.VizFrame({
width: "100%",
height: "400px",
vizType: "bar", // You can use other chart types too
dataset: oDataset, // your dataset
feeds: [
new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "size",
'type': "Measure",
'values': ["YourMeasure"]
}),
new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "color",
'type': "Dimension",
'values': ["YourDimension"]
})
]
});
// Customizing percentage formatting for the labels
var oFormat = sap.ui.core.format.NumberFormat.getPercentInstance({
style: "short", // Short format (e.g., 50% instead of 0.5)
minimumFractionDigits: 1, // Adjust this based on your requirements
maximumFractionDigits: 2
});
// Set custom label formatter
oVizFrame.setVizProperties({
plotArea: {
dataLabel: {
visible: true,
format: {
value: function (value) {
// Don't multiply by 100, directly use the value as is
return oFormat.format(value);
}
}
}
}
});
// Place the VizFrame on your page or view
oVizFrame.placeAt("yourContainer");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
29 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.