Ich versuche, ein Viz Diagramm in meinem Dialogfeld in SAP UI5 hinzuzufügen, aber nichts wird angezeigt. Hier ist mein Code, kann jemand bitte helfen! Ich habe ein Dialogfeld auf einer Druckmaschine hinzugefügt, die gut funktioniert. Auch ich habe Warnungen in verschiedenen Teilen nur um zu überprüfen, ob der Code ordnungsgemäß ausgeführt wird. Es gibt keinen Fehler, trotzdem sehe ich das Diagramm nicht im Dialogfeld.VizChart im Dialog in der SAP UI5
pressTemp: function() {
var oView = this.getView();
var oDialog = oView.byId("helloSiteDialog");
// create dialog lazily
if (!oDialog) {
// create dialog via fragment factory
oDialog = sap.ui.xmlfragment(oView.getId(), "Hari_At_Work.view.HelloSiteDialog", this);
var oVizFrame = this.getView().byId("idVizFrame");
oVizFrame.destroyDataset();
oVizFrame.destroyFeeds();
console.log("chart here");
//New dataset
oVizFrame.setDataset(new sap.viz.ui5.data.FlattenedDataset({
dimensions: [{
name: 'Timeline',
value: "{Country}"
}],
measures: [{
name: 'Value',
value: '{revenue}'
}],
data : {
path : "/businessData"
}
}));
alert("Dataset found");
//Add feeds
oVizFrame.addFeed(new sap.viz.ui5.controls.common.feeds.FeedItem({
uid: "categoryAxis",
type: "Dimension",
values: ["Timeline"]
}));
oVizFrame.addFeed(new sap.viz.ui5.controls.common.feeds.FeedItem({
uid: "valueAxis",
type: "Measure",
values: ["Value"]
}));
// oVizFrame.setModel(sap.ui.getCore().getModel());
var oModel = new sap.ui.model.json.JSONModel({
businessData: [{
Country: "Canada",
revenue: 410.87,
profit: -141.25,
population: 34789000
}, {
Country: "China",
revenue: 338.29,
profit: 133.82,
population: 1339724852
}, {
Country: "France",
revenue: 487.66,
profit: 348.76,
population: 65350000
}, {
Country: "Germany",
revenue: 470.23,
profit: 217.29,
population: 81799600
}, {
Country: "India",
revenue: 170.93,
profit: 117.00,
population: 1210193422
}, {
Country: "United States",
revenue: 905.08,
profit: 609.16,
population: 313490000
}]
});
oVizFrame.setModel(oModel);
alert("Model found");
oView.addDependent(oDialog);
}
oDialog.open();
// oVizFrame.invalidate();
},
Mein Fragment XML-Code:
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:l="sap.ui.layout" xmlns:viz.feeds="sap.viz.ui5.controls.common.feeds"
xmlns:viz.data="sap.viz.ui5.data" xmlns:viz="sap.viz.ui5.controls" xmlns:fb="sap.ui.comp.filterbar">
<Dialog id="helloSiteDialog" title="Temperature Trend">
<viz:VizFrame id="idVizFrame" uiConfig="{applicationSet:'fiori'}"
height='100%' width="100%" vizType='column'>
<viz:dataset>
<viz.data:FlattenedDataset data="{/businessData}">
<viz.data:dimensions>
<viz.data:DimensionDefinition name="Name"
value="{Country}" />
</viz.data:dimensions>
<viz.data:measures>
<viz.data:MeasureDefinition name="Revenue"
value="{revenue}" />
<viz.data:MeasureDefinition name="Cost"
value="{Cost}" />
</viz.data:measures>
</viz.data:FlattenedDataset>
</viz:dataset>
<viz:feeds>
<viz.feeds:FeedItem id='valueAxisFeed' uid="valueAxis" type="Measure"
values="Revenue" />
<viz.feeds:FeedItem id='categoryAxisFeed' uid="categoryAxis" type="Dimension"
values="Name" />
</viz:feeds>
</viz:VizFrame>
<beginButton>
<Button text="Close" press="onCloseSiteDialog"/>
</beginButton>
</Dialog>
Fragment hat nur einen normalen VizChart Code mit 'id = "idVizFrame"'. Meine Ansicht hat eigentlich nichts mit der Kontrolle zu tun. Alles passiert auf einer Presseaktion. Denken Sie zB auf einen Knopfdruck hin. – daisy
Ihr Code sieht in Ordnung .. –
Ya, der Code ist in Ordnung. Wie gesagt, es funktioniert, wenn ich es in einer anderen Ansicht (Seite) verwende. Aber in der Dialogbox erscheint es nicht. Voraussetzung ist, dass es im Dialogfeld angezeigt wird! – daisy