title: SAPUI5 -binding data to a chart inside a view repeater control
body: <p>Need a help on  SAPUI5, I am  trying to create a View as described below.
  I am using the View repeater control and inside the View repeater control using the VIZ chart control .
  The problem I am facing is not able to bind data to the chart though I am able to bind data to the repeater control. </p>
  
  <p>Below is the JSON I use.</p>
  
  <pre><code>    "plants":[
              {
                              "plant":"Plant1",
                              "cCode":"***",
                              "Function":[
                                                              {"FunName":"fun1","Count":10},
                                                              {"FunName":" fun2","Count":10},
                                                              {"FunName":" fun3","Count":10},
                                                              {"FunName":"fun4","Count":0},
                                                              {"FunName":"fun5","Count":11},
                                                              {"FunName":" fun6","Count":10},
                                                              {"FunName":"fun7","Count":10}
                              ]
  
              },
              {
                              "plant":"Plant2",
                              "cCode":"***",
                              "Function":[
                                                              {"FunName":"fun1","Count":10},
                                                              {"FunName":" fun2","Count":10},
                                                              {"FunName":" fun3","Count":10},
                                                              {"FunName":"fun4","Count":0},
                                                              {"FunName":"fun5","Count":11},
                                                              {"FunName":" fun6","Count":10},
                                                              {"FunName":"fun7","Count":10}
                              ]
  
  
              }
              ]
  </code></pre>
  
  <p>}</p>
  
  <p>My View:</p>
  
  <pre><code>createContent : function(oController) {
  //  var oModel = new sap.ui.model.json.JSONModel();
  //  oModel.loadData("model/plantreport.json");
      var oModel = new sap.ui.model.json.JSONModel({
                                              "plants":[
             {
                              "plant":"Plant1",
                              "cCode":"10",
                              "Function":[
                                                              {"FunName":"fun1","Count":10},
                                                              {"FunName":" fun2","Count":10},
                                                              {"FunName":" fun3","Count":10},
                                                              {"FunName":"fun4","Count":0},
                                                              {"FunName":"fun5","Count":11},
                                                              {"FunName":" fun6","Count":10},
                                                              {"FunName":"fun7","Count":10}
                              ]
  
              },
              {
                              "plant":"Plant2",
                              "cCode":"20",
                              "Function":[
                                                              {"FunName":"fun1","Count":10},
                                                              {"FunName":" fun2","Count":10},
                                                              {"FunName":" fun3","Count":10},
                                                              {"FunName":"fun4","Count":0},
                                                              {"FunName":"fun5","Count":11},
                                                              {"FunName":" fun6","Count":10},
                                                              {"FunName":"fun7","Count":10}
                              ]
  
  
              }
              ]
  
  
  
              });
  
      //////// CONTROL SECTION ///////////////////////////////////////////////////////////////////
      //
      //create view repeater title (optional)
      var oTitle_NoViews = new sap.ui.commons.Title({
          text:"Testing Please",
          level: sap.ui.commons.TitleLevel.H1
      });
  var oLayout = new sap.ui.layout.VerticalLayout();
      // create the row repeater control
      var oViewRepeater_NoViews = new sap.suite.ui.commons.ViewRepeater("vr_noViews",
      {  
              showViews: false,
              noData: new sap.ui.commons.TextView({text: "Sorry, no data available!"}),
              showSearchField: false,
              showMoreSteps: 10, // you can use 'Show More' feature instead of paging
  
              //set view properties directly to the repeater
              responsive: false,
              itemMinWidth: 210,
              numberOfRows: 12
      });
  
  
      oViewRepeater_NoViews.bindAggregation("rows", {
          path : "/plants",
          factory : function(sId, oContext) {
              var sPath = oContext.sPath;  
  
         //Text
          control = new sap.ui.commons.TextView();
          control.bindProperty("text",oContext.sPath+"/plant");
          oLayout.addContent(control);
          //add content to cell, cell to row
  
  
          var oTemplate =  new sap.viz.ui5.data.DimensionDefinition({
                  axis: 1,
                  name : "Plant Name"
              });
              oTemplate.bindProperty("value", "FunName", function(value) {
                  if (value) {
                      return value;
                  }
              });
  
              var oTemplate2 =  new sap.viz.ui5.data.MeasureDefinition({
                  name : "Count"
              });
              oTemplate2.bindProperty("value", "Count", function(value) {
                  if (value) {
                      return value;
                  }
                  return 0;
              });
  
              var oDataset = new sap.viz.ui5.data.FlattenedDataset({
                              dimensions : [ oTemplate ],
                              measures : [ oTemplate2 ]
              });
              oDataset.bindAggregation("data", sPath + "/Function");
  
              var oBarChart = new sap.viz.ui5.Bar({
                              width : "300px",
                              height : "250px",
                              plotArea : {
                                  xAxis : {
  
                                  }
                              },
                              title : {
                                  visible : true,
                                  text : 'MY Graph'
                              },
                              dataset : oDataset
              });
  
              oLayout.addContent(oBarChart);
                  return  oLayout;            
          }
      });
  
   oViewRepeater_NoViews.setModel(oModel);
  
       return new sap.m.Page({
              title: "Plant Report",
              showNavButton: "{device&gt;/isPhone}",
              navButtonPress: [oController.doNavBack, oController],
              content: [oViewRepeater_NoViews],
              headerContent: [],
              footer: new sap.m.Bar({})
          });
  }
  </code></pre>