cancel
Showing results for 
Search instead for 
Did you mean: 

VizChart on dialog in SAP UI5

Former Member
0 Kudos

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();

    },

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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