Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Uncaught TypeError: Cannot read property 'setDataset' of undefined

Hello Experts,

I am getting some Unknown error

Can any one help me to solve this ??

here is my view code:

<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"

  xmlns="sap.m" controllerName="demovizframe.V_chart"

  xmlns:viz="sap.viz.ui5.controls"

  xmlns:html="http://www.w3.org/1999/xhtml">

  <Page title="Title">

  <content>

  <viz:VizFrame xmlns="sap.viz" id="idcolumn" >

  </viz:VizFrame>

  </content>

  </Page>

</core:View>

my controller code :

var url2 ="http://xx.xx.xx.xx:8000/AC_ANALYTICS/Power111.xsodata/SENSOR_DETAILS1?$select=SO_TEXT_DT_MM_YYYY,HOUR,ATM_TEMPERATURE&$filter=SO_TEXT_DT_MM_YYYY eq '"+cval+"' &$format=json"; 

  var salesModel2 = new sap.ui.model.json.JSONModel();  

  salesModel2.loadData(url2);  

  var oVizFrame = this.getView().byId("idcolumn");

  var oDataset = new sap.viz.ui5.data.FlattenedDataset({

  dimensions : [{

  name : 'HOUR',

  value : "{HOUR}"}],

               

  measures : [{

  name : 'TEMP',

  value : '{ATM_TEMPERATURE}'} ],

             

  data : {

  path : "/d/results"

  }

  });

  oVizFrame.setDataset(oDataset);

  oVizFrame.setModel(salesModel2);

  oVizFrame.setVizType('line');

  oVizFrame.setVizProperties({

             plotArea: {

              colorPalette : d3.scale.category20().range()

                 }});

  var feedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({

       'uid': "valueAxis",

       'type': "Measure",

       'values': ["TEMP"]

     }),

     feedCategoryAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({

       'uid': "categoryAxis",

       'type': "Dimension",

       'values': ["HOUR"]

     });

  oVizFrame.addFeed(feedValueAxis);

  oVizFrame.addFeed(feedCategoryAxis);

Thanks in Advance,

Bharath

Tags:
Former Member
replied

yeah that is the problem...

try deleting one view or use

var oVizFrame = sap.ui.getCore().getControl("idcolumn");

dont use same controller for two views.

I just combined your two views and put this code in onInit method.

take a look

JS Bin - Collaborative JavaScript Debugging

Regards

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question