cancel
Showing results for 
Search instead for 
Did you mean: 

Viz Chart only shows last entry of Model

Former Member
0 Kudos

Hi all,

I'm creating an Viz Chart from oModal service, the service is delivering data as (odata):

There are more than 140 entries within this list.


// 1. Get the id of the VizFrame

  var oVizFrame = this._getVizFrame(Q1_FREIGABE_CHART);

// 2. Create a JSON Model and set the data

  var oModelT = oModel;//this._getOModel();

// 3. Create Viz dataset to feed to the data to the graph

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

  dimensions: [{

  name: "Zeit",

  value: "{ZeitVon}"

  }],

  measures: [{

  name: "Online",

  value: "{Bis30}"

  }, {

  name: "Offline",

  value: "{Bis60}"

  }],

  data: {

  path: "/EtDbDatenQ1AnzSet"

  }

  });

  oVizFrame.setDataset(oDataset);

  oVizFrame.setModel(oModelT);

  oVizFrame.setVizType("line");

// 4. Set Viz properties

  oVizFrame.setVizProperties({

  general: {

  layout: {

  padding: 0.04

  }

  },

  valueAxis: {

  title: {

  visible: true,

  text: "Anzahl"

  }

  },

  categoryAxis: {

  title: {

  visible: true,

  text: "Zeitraum"

  }

  },

  plotArea: {

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

  },

  title: {

  visible: false,

  text: "Auswertung Freigabeprozess"

  }

  });

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

  "uid": "valueAxis",

  "type": "Measure",

  "values": ["Online", "Offline"]

  });

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

  "uid": "categoryAxis",

  "type": "Dimension",

  "values": ["Zeit"]

  });

  oVizFrame.addFeed(feedValueAxis);

  oVizFrame.addFeed(feedCategoryAxis);

Running the application, it only shows the last entry!

Any idea why this is happen? While using an local created jsonModel it works... only with the original data from the server, as shown, it doesnt workss...

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Solved it, transforming the oModel to JSONModel, does the job for me:

  1. oModel.read("/EtDbDatenQ3Set", undefined, undefined, true, function(oData, response) {
  2.      var oModelJson = new JSONModel();
  3.      oModelJson.setData(oData);
  4. ...

Afterwards all the data could be seen in viz chart.

Answers (0)