on 09-19-2017 10:29 AM
I am trying to add a Viz chart on my Dialog Box in SAP UI5, but nothings gets displayed. Here is my code, can someone please help! I added a dialog box on a press which is working fine. Even i put alerts in various part just to check if the code is running proper. There is no error, still i dont see the chart in dialog box.
pressTemp: function() {
var oView = this.getView();
var oDialog = oView.byId("helloSiteDialog");
// create dialog lazily
if (!oDialog) {
// create dialog via fragment factory
oDialog = sap.ui.xmlfragment(oView.getId(), "Hari_At_Work.view.HelloSiteDialog", this);
var oVizFrame = this.getView().byId("idVizFrame");
oVizFrame.destroyDataset();
oVizFrame.destroyFeeds();
console.log("chart here");
//New dataset
oVizFrame.setDataset(new sap.viz.ui5.data.FlattenedDataset({
dimensions: [{
name: 'Timeline',
value: "{Country}"
}],
measures: [{
name: 'Value',
value: '{revenue}'
}],
data : {
path : "/businessData"
}
}));
alert("Dataset found");
//Add feeds
oVizFrame.addFeed(new sap.viz.ui5.controls.common.feeds.FeedItem({
uid: "categoryAxis",
type: "Dimension",
values: ["Timeline"]
}));
oVizFrame.addFeed(new sap.viz.ui5.controls.common.feeds.FeedItem({
uid: "valueAxis",
type: "Measure",
values: ["Value"]
}));
// oVizFrame.setModel(sap.ui.getCore().getModel());
var oModel = new sap.ui.model.json.JSONModel({
businessData: [{
Country: "Canada",
revenue: 410.87,
profit: -141.25,
population: 34789000
}, {
Country: "China",
revenue: 338.29,
profit: 133.82,
population: 1339724852
}, {
Country: "France",
revenue: 487.66,
profit: 348.76,
population: 65350000
}, {
Country: "Germany",
revenue: 470.23,
profit: 217.29,
population: 81799600
}, {
Country: "India",
revenue: 170.93,
profit: 117.00,
population: 1210193422
}, {
Country: "United States",
revenue: 905.08,
profit: 609.16,
population: 313490000
}]
});
oVizFrame.setModel(oModel);
alert("Model found");
oView.addDependent(oDialog);
}
oDialog.open();
// oVizFrame.invalidate();
},
i followed a previous question trail, which provides a solution. https://archive.sap.com/discussions/thread/3809882 But when i used .rendered() it throws me an error: Cannot read property 'rerender' of undefined
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.