製品版のみの機能
円チャート - XML のバインド
このサンプルは、XML 文字列にバインドされた円チャートを表示します。
このサンプルは CTP 機能を使用しています。製品版では、API や動作が変更される場合があります。
このサンプルは、より大きい画面サイズのためにデザインされました。
モバイル デバイスで画面を回転、フル サイズ表示、またはその他のデバイスにメールで送信します。
コード ビュー
クリップボードへコピー
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Ignite UI for jQuery Required Combined CSS Files -->
<link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" />
<link href="http://cdn-na.infragistics.com/igniteui/2024.2/latest/css/structure/infragistics.css" rel="stylesheet" />
<script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js"></script>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
<!-- Ignite UI for jQuery Required Combined JavaScript Files -->
<script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.core.js"></script>
<script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.dv.js"></script>
<script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.lob.js"></script>
</head>
<body>
<style type="text/css">
#chart {
position: relative;
float: left;
margin-right: 10px;
margin-bottom: 10px;
}
</style>
<div id="chart"></div>
<script>
$(function () {
//Sample XML Data
var xmlDoc = '<Countries>' +
'<Country Name="中国" Population="1333" />' +
'<Country Name="インド" Population="1140" />' +
'<Country Name="米国" Population="304" />' +
'<Country Name="インドネシア" Population="228" />' +
'<Country Name="ブラジル" Population="192" />' +
'</Countries>';
//Binding to XML requires a schema to define data fields
var xmlSchema = new $.ig.DataSchema("xml",
{
//searchField serves as the base node(s) for the XPaths
searchField: "//Country",
fields: [
{ name: "Name", xpath: "./@Name" },
{ name: "Population", xpath: "./@Population", type: "number" },
]
}
);
//This creates an Infragistics datasource from the XML
//and the Schema which can be consumed by the grid.
var ds = new $.ig.DataSource({
type: "xml",
dataSource: xmlDoc,
schema: xmlSchema
});
$("#chart").igPieChart({
width: "435px",
height: "435px",
dataSource: ds,
valueMemberPath: "Population",
labelMemberPath: "Name",
labelsPosition: "bestFit"
});
});
</script>
</body>
</html>