Skip to content

Instantly share code, notes, and snippets.

@ikiw
Created July 17, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikiw/515c1a38666c5d75878d to your computer and use it in GitHub Desktop.
Save ikiw/515c1a38666c5d75878d to your computer and use it in GitHub Desktop.
viz frame bubble chart
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8' />
<script src="/sapui5/resources/sap-ui-core.js" type="text/javascript" id="sap-ui-bootstrap" data-sap-ui-libs="sap.m,sap.viz,sap.ui.commons" data-sap-ui-theme="sap_bluecrystal">
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
<script>
var aData = [{
"Country": "AR",
"Time": "201201",
"DSO": "50.29",
"DSO1": "50.29",
"DSO2": "50.29",
"DSO3": "50.29",
}, {
"Country": "BR",
"Time": "201201",
"DSO": "60.81",
"DSO1": "60.29",
"DSO2": "60.29",
"DSO3": "60.29",
}, {
"Country": "CN",
"Time": "201201",
"DSO": "52",
"DSO1": "50.29",
"DSO2": "50.29",
"DSO3": "50.29",
}, {
"Country": "VE",
"Time": "201204",
"DSO": "33.85",
"DSO1": "50.29",
"DSO2": "50.29",
"DSO3": "50.29",
}];
var oModel1 = new sap.ui.model.json.JSONModel();
oModel1.setData({
lineData1: aData
});
var oDataSet1 = new sap.viz.ui5.data.FlattenedDataset({
dimensions: [{
name: "Time",
value: "{Time}"
}, {
name: "Country",
value: "{Country}"
}],
measures: [{
name: "DSO",
value: {
path: "DSO",
formatter: function(d) {
return parseFloat(d);
}
},
}],
data: {
path: "/lineData1"
}
});
var oVizFrame1 = new sap.viz.ui5.controls.VizFrame({
vizType: "info/bubble", //or scatter ( bubblewidth/bubbleHeight becomes optional)
uiConfig: {
applicationSet: "fiori"
}
});
oVizFrame1.setDataset(oDataSet1);
oVizFrame1.setModel(oModel1);
var feedPrimaryValues1 = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "valueAxis",
'type': "Measure",
'values': ["DSO"]
}),
feedPrimaryValues2 = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "valueAxis2",
'type': "Measure",
'values': ["DSO"]
}),
feedPrimaryValues3 = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "bubbleWidth",
'type': "Measure",
'values': ["DSO"]
}),
feedPrimaryValues4 = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "bubbleHeight",
'type': "Measure",
'values': ["DSO"]
}),
feedAxisLabels1 = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "color",
'type': "Dimension",
'values': ["Country"]
}),
feedAxisLabels11 = new sap.viz.ui5.controls.common.feeds.FeedItem({
"uid": "shape",
'type': "Dimension",
'values': ["Time"]
});
oVizFrame1.addFeed(feedPrimaryValues1);
oVizFrame1.addFeed(feedPrimaryValues2);
oVizFrame1.addFeed(feedPrimaryValues3);
oVizFrame1.addFeed(feedPrimaryValues4);
oVizFrame1.addFeed(feedAxisLabels1);
oVizFrame1.addFeed(feedAxisLabels11);
oVizFrame1.placeAt("content");
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment