Friday, 9 November 2018

sapui5 pure xml create chart

view
 <core:View xmlns:core="sap.ui.core" xmlns:viz="sap.viz.ui5.controls" xmlns:viz.feeds="sap.viz.ui5.controls.common.feeds" xmlns:viz.data="sap.viz.ui5.data" xmlns="sap.m" controllerName="chart10.chart10">
    <App>
      <Page title="SAPUI5 App">
        <viz:VizFrame xmlns:viz="sap.viz.ui5.controls" id="lineChartCard" uiConfig="{applicationSet:'fiori'}" vizType="column" width="100%">
          <viz:dataset>
            <dataSet:FlattenedDataset xmlns:dataSet="sap.viz.ui5.data" data="{/SalesShare}">
              <dataSet:dimensions>
                <dataSet:DimensionDefinition name="Date" value="{Date}">
                </dataSet:DimensionDefinition>
              </dataSet:dimensions>
              <dataSet:measures>
                <dataSet:MeasureDefinition name="Price" value="{Price}">
                </dataSet:MeasureDefinition>

              </dataSet:measures>
            </dataSet:FlattenedDataset>
          </viz:dataset>
          <viz:feeds>
            <feed:FeedItem xmlns:feed="sap.viz.ui5.controls.common.feeds" uid="valueAxis" type="Measure" values="Price" />
            <feed:FeedItem xmlns:feed="sap.viz.ui5.controls.common.feeds" uid="categoryAxis" type="Dimension" values="Date" />

          </viz:feeds>
        </viz:VizFrame>
      </Page>
    </App>
  </core:View>

controller

sap.ui.controller("chart10.chart10", {


  onInit: function() {
    var oData = {
      "SalesShare": [{
        "Date": "2nd Jan",
        "Price": "400"
      }, {
        "Date": "2nd Feb",
        "Price": "275"
      }, {
        "Date": "4th May",
        "Price": "356"
      }, {
        "Date": "6th June",
        "Price": "310"
      }]
    };
    var oModel = new sap.ui.model.json.JSONModel(oData);
    this.getView().setModel(oModel);
  },
});


output


No comments:

Post a Comment

test ganaral binding(testing )

  /home/user/projects/project1/webapp/model/record.json: {     "text" : "outer text" ,     "myrecorsd" : [    ...