Created
June 30, 2021 18:18
-
-
Save chamithchathuka/1102f939488d898f29102407cc6242ab to your computer and use it in GitHub Desktop.
SAP UI5 Viz Chart in JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let oVizFrame = that.getView().byId("idcolumn"); | |
let oDataSet = new sap.viz.ui5.data.FlattenedDataset({ | |
dimensions: [ | |
{ | |
name: "Brands", | |
value: "{Model>Brand}" | |
} | |
], | |
measures: [{ | |
name: "Cars Bought", | |
value: "{Model>Value}", | |
}], | |
data: { | |
path: "Model>/Cars" | |
} | |
}); | |
oVizFrame.setDataset(oDataSet); | |
oVizFrame.setVizType("bar"); | |
// set properties | |
oVizFrame.setVizProperties({ | |
plotArea: { | |
colourPalette: d3.scale.category20().range(), | |
}, | |
title: { | |
visible: "true", | |
text: "VizFrame Chart" | |
} | |
}); | |
var feedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({ | |
'uid':"valueAxis", | |
'type': "Measure", | |
'value': ["Cars Bought"] | |
}), | |
feedCategoryAxis = new sap.ui5.controls.common.feeds.FeedItem({ | |
'uid':"categoryAxis", | |
'type': "Dimension", | |
'value': ["Brands"] | |
}); | |
oVizFrame.addFeed(feedValueAxis); | |
oVizFrame.addFeed(feedCategoryAxis); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment