2017-09-19 1 views
0

SAP UI5의 대화 상자에 Viz 차트를 추가하려고하지만 nothings이 표시됩니다. 여기 내 코드입니다, 누군가 도와주세요! 나는 잘 작동하는 언론에 대화 상자를 추가했습니다. 심지어 나는 코드가 제대로 작동하는지 확인하기 위해 여러 부분에 경고를합니다. 아무런 오류가 없습니다, 여전히 나는 대화 상자에서 차트를 보지 못했습니다.SAP UI5 대화 상자의 VizChart

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(); 

    }, 

내 조각 XML 코드 :

<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> 

답변

-1

는 또한보기와 조각 code..I를 붙여 나를 plunkr.Are 당신의 샘플을 참조하여 code.The지도가 표시되고 시도 콘솔에 오류가 있습니까? 나는 코드의 변화 popover.so 사용했다 Plunk of vizframe

oDialog.openBy(btn); 
+0

조각이'ID = "idVizFrame"'와 단지 일반 VizChart 코드가 있습니다. 내 견해는 실제로 통제와 관련이 없습니다. 언론의 모든 일에서 일어나는 일. 예를 들어 버튼을 클릭 할 때 고려해야합니다. – daisy

+0

코드가 괜찮아 보입니다 .. –

+0

예, 코드가 괜찮습니다. 내가 말했듯이, 다른 뷰 (페이지)에서 사용한다면 그것의 작동. 그러나 대화 상자에서 나타나지 않습니다. 요구 사항은 대화 상자에 표시하는 것입니다! – daisy

관련 문제