Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Unable to display the column chart using Analytical view data

$
0
0

Hello All,

 

We have created a analytical view and created a OData in test.xsodata and with two fields ( attribute, measure  )

 

service {

        "package/ANA_VW.analyticview" as "Analview" keys generate local "GENERATED_ID" aggregates always (SUM of "measure ");

}

 

 

Then i am fetching the data by calling this service into a oTable in the view as shown .

 

    var oModel = new sap.ui.model.odata.ODataModel("../../../services/Analview.xsodata/", true);

     

          var oControl;

         

       oTable = new sap.ui.table.Table("test",{tableId: "tableID",

              visibleRowCount: 16});

      

       oTable.setTitle("measure");

      

       oControl = new sap.ui.commons.TextField().bindProperty("value","attribute");

          oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text: "attribute"}), template: oControl, sortProperty: "attribute", filterProperty: "attribute", width: "125px" }));

    

          oControl = new sap.ui.commons.TextField().bindProperty("value","measure");

          oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text: "measure"}), template: oControl, sortProperty: "measure", filterProperty: "measure", width: "125px" }));

  

      

       oTable.setModel(oModel);

    var sort1 = new sap.ui.model.Sorter("attribute");

      // oTable.bindRows("/Analview/?$select=attribute,measure",sort1);

    oTable.bindRows({

             path: "/Analview",

             parameters: {

                 select: "attribute,measure"},

                 sorter: new sap.ui.model.Sorter("attribute",true),

    });

 

 

 

Now my requirement is I want to use the data fetched in oTable and assign the values of  attribute  and  measure  to the column charts.....using  sap.viz.ui5.StackedColumn or sap.service.visualization.chart.Column.. 

 

 

I have searched all the forum discussions and found in most of the cases they are using static data in displaying in charts..can some one guide us how to use the data from oTable in parsing and displaying in any one of the above two chart methods...

 

 

Below is the code which i used to call the column chart..

 

    var dataset = new sap.service.visualization.dataset.SimpleDMDataset();

     dataset.setDataTable(oTable);

 

 

      var charts =  new sap.viz.ui5.StackedColumn("oChart",{  

         width : "800px",  

         height : "400px",  

         title : { visible : true, text : 'Test Stacked Column Chart' },  

         dataset : dataset  

       });

 

Note:- The service is returning the correct data. So the issue is i have to parse the data and assign it to some variable which we can use in StackedColum or chart,Column

 

Thanks

Ramesh


Viewing all articles
Browse latest Browse all 6412

Trending Articles