Code: Alles auswählen.
createContent : function(oController) {
var content = [];
var html1 = new sap.ui.core.HTML(
"html1",
{
content : "<div id=\"piechart_3d\" style=\"width: 900px; height: 500px;\"></div>",
preferDOM : false,
afterRendering : function(e) {
google.setOnLoadCallback(oController
.drawChart());
}
});
var oPanel = new sap.ui.commons.Panel();
oPanel.setTitle(new sap.ui.core.Title({
text : "Google Chart"
}));
var oBackButton = new sap.ui.commons.Button({
text : "Back",
press: [oController.backToPage, oController]
});
var app = new sap.ui.getCore().byId("moreId");
oPanel.addContent(html1);
oPanel.addButton(oBackButton);
content.push(oPanel);
return new sap.m.Page({
title : "Kreisdiagramm",
navButtonPress : function() {
app.back();
},
content : [ content ]
});
}
Code: Alles auswählen.
drawChart : function() {
me = this;
data = google.visualization.arrayToDataTable([
[ 'Task', 'Hours per Day' ], [ 'Anlagevermögen', 938494.5], [ 'Umlaufvermögen', 917969.6 ],
[ 'Vorraete', 524262.16 ], [ 'Forderungen', 393707.47 ], [ 'Eigenkapital', 335512.12 ] ]);
var options = {
title : 'Bilanz in €',
is3D : true,
slices : {
0 : {
offset : 0.2
}
},
legend : {
position : 'left',
textStyle : {
color : 'blue',
fontSize : 16
}
},
};
chart = new google.visualization.PieChart(document
.getElementById('piechart_3d'));
chart.draw(data, options);
google.visualization.events.addListener(chart, 'select',
this.selectHandler);
},
selectHandler : function() {
var selection = chart.getSelection();
var message = '';
// for (var i = 0; i < selection.length; i++) {
// var item = selection[i];
// if (item.row != null && item.column != null) {
// var str = data.getFormattedValue(item.row, item.column);
// message += '{row:' + item.row + ',column:' + item.column
// + '} = ' + str + '\n';
// } else if (item.row != null) {
// var str = data.getFormattedValue(item.row, 0);
// message += '{row:' + item.row
// + ', column:none}; value (col 0) = ' + str + '\n';
// } else if (item.column != null) {
// var str = data.getFormattedValue(0, item.column);
// message += '{row:none, column:' + item.column
// + '}; value (row 0) = ' + str + '\n';
// }
// }
if (message == '') {
message = 'nothing';
}
alert('You selected ' + message);
},
backToPage: function(){
var app = new sap.ui.getCore().byId("moreId");
app.toDetail("dashboardId", "flip")
}