您好,由于某些原因,我的实现树图未绘制。
我无法自己解决此错误,因为我什至都没有收到错误消息。
这是我检索数据的方式:
self = this;
var dataPath = "/xsodata/getPortfolio.xsodata";
var dataModel = new sap.ui.model.json.JSONModel(dataPath + "/portfolioSet");
dataModel.attachRequestCompleted(function () {
var oVizFrame = self.getView().byId("idVizFrame");
oVizFrame.setModel(dataModel);
});
这是我的看法:
<viz:VizFrame id="idVizFrame" height="100%" width="100%" vizType="treemap">
<viz:dataset>
<viz.data:FlattenedDataset data="{/d/results}">
<viz.data:dimensions>
<viz.data:DimensionDefinition name="DEPARTMENT" value="{DEPARTMENT}"/>
<viz.data:DimensionDefinition name="AISLE" value="{AISLE}"/>
</viz.data:dimensions>
<viz.data:measures>
<viz.data:MeasureDefinition name="ANZAHL_PRODUCTS" value="{ANZAHL_PRODUCTS}"/>
<viz.data:MeasureDefinition name="ANZAHL_ORDERS" value="{ANZAHL_ORDERS}"/>
</viz.data:measures>
</viz.data:FlattenedDataset>
</viz:dataset>
<viz:feeds>
<viz.feeds:FeedItem uid="color" type="Measure" values="ANZAHL_PRODUCTS"/>
<viz.feeds:FeedItem uid="weight" type="Measure" values="ANZAHL_ORDERS"/>
<viz.feeds:FeedItem uid="title" type="Dimension" values="DEPARTMENT"/>
<viz.feeds:FeedItem uid="title" type="Dimension" values="AISLE"/>
</viz:feeds>
</viz:VizFrame>
xsodata的小样本:
{"d":{"results":[{"__metadata":{"uri":"https://hxehost:51026/xsodata/getportfolio.xsodata/portfolioSet('alcohol')","type":"default.portfolioSetType"},"ANZAHL_PRODUCTS":385,"ANZAHL_ORDERS":48657,"DEPARTMENT":"alcohol","AISLE":"beers coolers"},{"__metadata":{"uri":"https://hxehost:51026/xsodata/getportfolio.xsodata/portfolioSet('alcohol')","type":"default.portfolioSetType"},"ANZAHL_PRODUCTS":95,"ANZAHL_ORDERS":11198,"DEPARTMENT":"alcohol","AISLE":"specialty wines champagnes"},{"__metadata":{"uri":"https://hxehost:51026/xsodata/getportfolio.xsodata/portfolioSet('alcohol')","type":"default.portfolioSetType"},"ANZAHL_PRODUCTS":232,"ANZAHL_ORDERS":35181,"DEPARTMENT":"alcohol","AISLE":"red wines"},{"__metadata":{"uri":"https://hxehost:51026/xsodata/getportfolio.xsodata/portfolioSet('alcohol')","type":"default.portfolioSetType"},"ANZAHL_PRODUCTS":195,"ANZAHL_ORDERS":28102,"DEPARTMENT":"alcohol","AISLE":"spirits"}
编辑:我在IconTab中有图表。由于我使用了height =“ 100%” width =“ 100%”,所以没有绘制。我已经减少了height和width属性,现在可以使用了。