Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chamithchathuka/1102f939488d898f29102407cc6242ab to your computer and use it in GitHub Desktop.
Save chamithchathuka/1102f939488d898f29102407cc6242ab to your computer and use it in GitHub Desktop.
SAP UI5 Viz Chart in JS
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