製品版のみの機能
ファンネル チャート - スライスの選択
このサンプルは CTP 機能を使用しています。製品版では、API や動作が変更される場合があります。
定義済みスタイルの選択
カスタム スタイルの選択
選択されたスライス (スライス選択が実行されるまでグリッドは空です):
このサンプルは、より大きい画面サイズのためにデザインされました。
モバイル デバイスで画面を回転、フル サイズ表示、またはその他のデバイスにメールで送信します。
このサンプルでは、スライスの選択機能を有効にし、sliceSelected イベントを処理する方法を紹介します。
コード ビュー
クリップボードへコピー
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<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" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js" type="text/javascript"></script>
<!-- Ignite UI for jQuery Required Combined JavaScript Files -->
<script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.core.js" type="text/javascript"></script>
<script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.lob.js" type="text/javascript"></script>
<script src="http://cdn-na.infragistics.com/igniteui/2024.2/latest/js/infragistics.dv.js" type="text/javascript"></script>
</head>
<body>
<link href="/css/charts/chart-samples.css" type="text/css" rel="stylesheet" />
<script type="text/javascript">
var data = [
{ Budget: 30, Department: "事務" },
{ Budget: 50, Department: "セールス" },
{ Budget: 60, Department: "IT" },
{ Budget: 50, Department: "マーケティング" },
{ Budget: 100, Department: "開発" },
{ Budget: 20, Department: "サポート" }
];
var selectedSlices = [];
$(function () {
// Create a funnel chart with slice selection allowed and an event handler for
// the sliceClicked event. The styles for selected and unselected slices from
// infragistics.theme.css file are used and redefined in the <style> node of the page.
$("#chart").igFunnelChart({
width: "100%",
height: "500px",
dataSource: data,
valueMemberPath: "Budget",
innerLabelMemberPath: "Budget",
innerLabelVisibility: "visible",
outerLabelMemberPath: "Department",
outerLabelVisibility: "visible",
allowSliceSelection: true,
useUnselectedStyle: true,
sliceClicked: function (evt, ui) {
if (ui.selected) {
selectedSlices.push(ui.item);
}
else {
selectedSlices.removeItem(ui.item);
}
$("#selectedSlicesGrid").igGrid("dataBind");
}
});
// Create a funnel chart with slice selection allowed and custom styles for selected and
// unselected slices defined in the selectedSliceStyle & unselectedSliceStyle options.
$("#chartCustom").igFunnelChart({
width: "100%",
height: "500px",
dataSource: data,
valueMemberPath: "Budget",
innerLabelMemberPath: "Budget",
innerLabelVisibility: "visible",
outerLabelMemberPath: "Department",
outerLabelVisibility: "visible",
allowSliceSelection: true,
useUnselectedStyle: true,
selectedSliceStyle: {
fill: "lightblue",
stroke: "black"
},
unselectedSliceStyle: {
fill: "lightgrey",
stroke: "grey"
}
});
// Instantiate the selected slices grid
$("#selectedSlicesGrid").igGrid({
dataSource: selectedSlices,
columns: [
{ key: "Department", headerText: "グループ", width: "130px" },
{ key: "Budget", headerText: "予算", width: "70px" }
]
});
});
</script>
<style type="text/css">
/*
Redefine the styles from infragistics.theme.css that configure the appearance of
selected and unselected slices.
*/
.ui-funnel-slice-selected
{
opacity: 1;
}
.ui-funnel-slice-unselected
{
opacity: 0.4;
border: 1px solid black;
}
</style>
<div class="sampleContent">
<div class="chartContainer">
<h4>定義済みスタイルの選択</h4>
<div id="chart"></div>
</div>
<div class="chartContainer">
<h4>カスタム スタイルの選択</h4>
<div id="chartCustom"></div>
</div>
<div>
<div style="float: left; padding-top: 7px; border-bottom: 1px solid #d0d0d0; width: 100%;">
</div>
<div style="float: left; padding-top: 20px;">
<h4 style="float: left;">選択されたスライス (スライス選択が実行されるまでグリッドは空です): </h4>
</div>
<div style="float: left; padding-top: 8px;">
<table id="selectedSlicesGrid"></table>
</div>
</div>
</div>
</body>
</html>