【发布时间】:2014-05-06 11:00:49
【问题描述】:
我正在从事 SAP HANA 开发项目,我需要使用 SAPUI5 和 Odata 服务开发 UI 应用程序。
我需要有关从 HANA 表中获取数据并在饼图或条形图中显示的帮助。 我正在使用 odata 服务将数据获取到表(oTable),但无法在饼图中显示。
请在下面找到代码sn-p:
{
var oModel = sap.ui.model.odata.ODataModel('link of the .xsodata' false);
var oTable = new sap.ui.table.Table({tableId: "tableID", visibleRowCount: 10});
oTable.setTitle("Transactions");
oTable.setModel(oModel);
oTable.bindRows('/Transactions');
var dataset = new sap.service.visualization.dataset.SimpleDMDataset();
dataset.setDataTable(oTable);
var pie = new sap.service.visualization.chart.Pie("myPie", {
width: "700px",
height: "400px",
allDeSelectable: true,
legendFirst: true,
selectionMode: 'single',
legendDirection: 'right',
title: 'Transactions',
titleHorizontalAlign: 'center',
subTitle: 'Q1 - 2012',
subTitleHorizontalAlign: 'center',
showTitle: true,
defaultSelectedSliceIndexes: [5],
legendFormatString: ['0.00%'],
tooltipTextFormatString: ['0.00%'],
tooltipMainValueFormatString: ['#,##0'],
tooltipSubValueFormatString: ['0.00%'],
showLegend: true,
pieType: 'pie',
dataset: dataset
});
pie.placeAt("uiAreaForMyControls");
}
由于我是新手且处于学习阶段,请帮助我将饼图与数据一起显示。
【问题讨论】:
标签: sapui5