我现在坐在这件事上几个小时没有运气。如果有一个带有XPS12的SAP HANA,我正在进行一些数据可视化。我使用TwitterAdapter将一些数据加载到HANA中,然后针对每个政党对此进行情感分析。从中制作了ODATA服务,现在我尝试使用SAP UI5显示结果。这适用于所有分离的各方,但概述页面没有运气。
我想要实现的目标:
堆积柱形图,每列代表一方(SPD,CDU等),每个颜色应代表每个检测到的推文情绪的计数。
我的xsodata文件如下所示:
service {
"tester_01::CV_FDP" as "FDP"
keys generate local "ID1"
aggregates always;
"tester_01::CV_AFD" as "AFD"
keys generate local "ID1"
aggregates always;
"tester_01::CV_SPD" as "SPD"
keys generate local "ID1"
aggregates always;
"tester_01::CV_GRUENE" as "GRUENE"
keys generate local "ID1"
aggregates always;
"tester_01::CV_LINKE" as "LINKE"
keys generate local "ID1"
aggregates always;
"tester_01::CV_CDUCSU" as "CDUCSU"
keys generate local "ID1"
aggregates always;
}
不知何故“ID”是计数,但我不知道我哪里出错了。无论如何,因为我现在只需要显示它。
详细信息页面的我的视图和控制器看起来像这样,它可以工作:
sap.ui.controller("content.Afd", {
onInit: function() {
var dataModel = new sap.ui.model.odata.ODataModel(
"models/tester.xsodata"
);
this.getView().setModel(dataModel);
},
onExit: function() {
},
onAfterRendering: function() {
},
onBeforeRendering: function() {
}
});
查看:
<mvc:View controllerName="content.Afd"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
xmlns:table="sap.ui.table"
xmlns:viz="sap.viz.ui5.controls"
xmlns:viz.feeds="sap.viz.ui5.controls.common.feeds"
xmlns:viz.data="sap.viz.ui5.data"
xmlns:l="sap.ui.commons.layout"
xmlns:html="http://www.w3.org/1999/xhtml">
<html:p/>
<table:Table
id="AfdTable"
visibleRowCount="10"
selectionMode="Single"
navigationMode="Paginator"
editable="false"
rows="{/AFD}">
<table:Column sortProperty="ID">
<table:label>
<Label text="Häufigkeit" design="Bold"/>
</table:label>
<table:template>
<Label text="{ID}"/>
</table:template>
</table:Column>
<table:Column sortProperty="TA_TOKEN">
<table:label>
<Label text="Wort" design="Bold"/>
</table:label>
<table:template>
<Label text="{TA_TOKEN}"/>
</table:template>
</table:Column>
<table:Column sortProperty="TA_TYPE">
<Label text="Stimmung" design="Bold"/>
<table:template>
<Label text="{TA_TYPE}"/>
</table:template>
</table:Column>
</table:Table>
<viz:VizFrame
id="afd_pie"
width="100%"
height="800px"
vizType="info/pie"
uiConfig="{
applicationSet:'fiori'
}"
vizProperties="{
plotArea:{
dataLabel : {
visible : true
},
dataPointSize : {
min : 0,
max : 4
}
},
title: {
alignment :'left',
visible : true,
text : 'Tweet Stimmung'
}
}">
<viz:dataset>
<viz.data:FlattenedDataset id="flattenedData" data="{/AFD}">
<viz.data:dimensions>
<viz.data:DimensionDefinition name="Typ" value="{TA_TYPE}" />
</viz.data:dimensions>
<viz.data:measures>
<viz.data:MeasureDefinition name="Anzahl" value="{ID}" />
</viz.data:measures>
</viz.data:FlattenedDataset>
</viz:dataset>
<viz:feeds>
<viz.feeds:FeedItem uid="size" type="Measure" values="Anzahl" />
<viz.feeds:FeedItem uid="color" type="Dimension" values="Typ" />
</viz:feeds>
</viz:VizFrame>
</mvc:View>
截图:
那么我现在如何获得带有堆积柱形图的单个概述页面?我尝试过这样的一切:
<mvc:View controllerName="content.Uebersicht"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
xmlns:viz="sap.viz.ui5.controls"
xmlns:viz.feeds="sap.viz.ui5.controls.common.feeds"
xmlns:viz.data="sap.viz.ui5.data"
xmlns:html="http://www.w3.org/1999/xhtml">
<!-- view content goes here -->
<html:p/>
<viz:VizFrame
id="barchart"
width="100%"
height="800px"
vizType="stacked_column"
uiConfig="{
applicationSet:'fiori'
}"
vizProperties="{
plotArea:{
dataLabel : {
visible : true
},
dataPointSize : {
min : 0,
max : 4
}
},
title: {
alignment :'left',
visible : true,
text : 'Übersicht über Stimmung'
}
}">
<viz:dataset>
<viz.data:FlattenedDataset data="{/}">
<viz.data:dimensions>
<viz.data:DimensionDefinition name="Partei1"
value="AfD" />
<viz.data:DimensionDefinition name="Partei2"
value="CDU/CSU" />
<viz.data:DimensionDefinition name="Partei3"
value="AfD" />
<viz.data:DimensionDefinition name="Partei4"
value="CDU/CSU" />
</viz.data:dimensions>
<viz.data:measures>
<viz.data:MeasureDefinition name="Count1"
value="{/SPD:ID}" />
<viz.data:MeasureDefinition name="Count2"
value="{/AFD:ID}" />
</viz.data:measures>
</viz.data:FlattenedDataset>
</viz:dataset>
<viz:feeds>
<viz.feeds:FeedItem uid="valueAxis" type="Measure"
values="Count1,Count2" />
<viz.feeds:FeedItem uid="categoryAxis" type="Dimension"
values="Partei1" />
<viz.feeds:FeedItem uid="categoryAxis" type="Dimension"
values="Partei2" />
<viz.feeds:FeedItem uid="categoryAxis" type="Dimension"
values="Partei3" />
<viz.feeds:FeedItem uid="categoryAxis" type="Dimension"
values="Partei4" />
</viz:feeds>
</viz:VizFrame>
</mvc:View>
这会产生无效的数据绑定错误。
请帮忙。
由于