How do I change the legend title as shown in the screenshot to something like count of all vertical bars. Ex; Total: 11
Also why does the default start y-axis value start from 500m ? How do I change it ?
Sample Screenshot below
CONTROLLER CODE:
onInit: function() {
// 1.Get the id of the VizFrame
var oVizFrame = this.getView().byId("idcolumn");
// 2.Create a JSON Model and set the data
var oModel = new sap.ui.model.json.JSONModel();
var data = {
'Coaches' : [
{"Name": "Singapore","Value": "1"},
{"Name": "India","Value": "1"},
{"Name": "Germany","Value": "2"},
{"Name": "South Africa","Value": "1"},
{"Name": "Turkey","Value": "0"},
{"Name": "Japan","Value": "1"},
{"Name": "China","Value": "2"},
{"Name": "France","Value": "2"},
{"Name": "ArgentinasdfsdfddfsdfsdAA","Value": "1"},
]};
oModel.setData(data);
this.getView().setModel(oModel);
// 3. Create Viz dataset to feed to the data to the graph
var oDataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions : [{ name : 'Country',value : "{Name}" }],
measures : [{ name : 'Total No of KFC Branches', value : '{Value}' }],
data : { path : "/Coaches" }
});
// Binding Model and Dataset to the Frame
oVizFrame.setDataset(oDataset);
oVizFrame.setModel(oModel);
oVizFrame.setVizType('column'); // column or bar
// 4.Set Viz properties
// Ref Link: https://sapui5.netweaver.ondemand.com/docs/vizdocs/index.html#reference/chartProperty/Charts/Bar%20%20(13)/Column%20Chart/
oVizFrame.setVizProperties({
title: { text : "KFC Statistics" },
general: { background : { border : { top : { visible : true } } } },
general: { background : { border : { bottom : { visible : true } } } },
general: { background : { border : { right : { visible : true } } } },
general: { background : { border : { left : { visible : true } } } },
// valueAxis: { title : { text : "Totallll" }},
legend: { isScrollable : true },
legend: { visible : true },
legend: { title : { visible : true } },
legend: { title : { text : "All Measures" } },
plotArea: { dataLabel : { visible : true} }
});
// Axis Specification
var feedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "valueAxis",
'type': "Measure",
'values': ["Total No of KFC Branches"]
}),
feedCategoryAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "categoryAxis",
'type': "Dimension",
'values': ["Country"]
});`enter code here`
// Addition of Axis to Frame
oVizFrame.addFeed(feedValueAxis);
oVizFrame.addFeed(feedCategoryAxis);
}