製品版のみの機能
データ チャート - カスタムシリーズのハイライト
このサンプルでは、assigningCategoryStyle イベントを使用して、ハイライトされた列を変更する代わりに、ハイライトされていない列をフェードするために変更する方法を紹介します。
このサンプルは CTP 機能を使用しています。製品版では、API や動作が変更される場合があります。
人口のデータ ソース:
Quandl
このサンプルは、より大きい画面サイズのためにデザインされました。
モバイル デバイスで画面を回転、フル サイズ表示、またはその他のデバイスにメールで送信します。
コード ビュー
クリップボードへコピー
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Custom Series Highlighting</title> <!-- Ignite UI for jQuery Required Combined CSS Files --> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/structure/infragistics.css" rel="stylesheet" /> <!--CSS file specific for chart styling --> <link href="http://cdn-na.infragistics.com/igniteui/2024.1/latest/css/structure/modules/infragistics.ui.chart.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.1/latest/js/infragistics.core.js"></script> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.dv.js"></script> </head> <body> <script type="text/javascript" src="/data-files/uk-france-population.js"></script> <script type="text/javascript"> $(function () { var data = [ { "CountryName": "China", "Pop1995": 1216, "Pop2005": 1297, "Pop2015": 1361, "Pop2025": 1394 }, { "CountryName": "India", "Pop1995": 920, "Pop2005": 1090, "Pop2015": 1251, "Pop2025": 1396 }, { "CountryName": "United States", "Pop1995": 266, "Pop2005": 295, "Pop2015": 322, "Pop2025": 351 }, { "CountryName": "Indonesia", "Pop1995": 197, "Pop2005": 229, "Pop2015": 256, "Pop2025": 277 }, { "CountryName": "Brazil", "Pop1995": 161, "Pop2005": 186, "Pop2015": 204, "Pop2025": 218 } ]; $("#chart").igDataChart({ width: "100%", height: "400px", title: "国別人口", subtitle: "2005 年の人口", dataSource: data, axes: [ { name: "NameAxis", type: "categoryX", title: "国", label: "CountryName" }, { name: "PopulationAxis", type: "numericY", minimumValue: 0, title: "人口 (百万人単位)", } ], series: [{ name: "2005Population", type: "column", title: "2005 Population", isHighlightingEnabled: true, isTransitionInEnabled: true, xAxis: "NameAxis", yAxis: "PopulationAxis", valueMemberPath: "Pop2005", showTooltip: true, isCustomCategoryStyleAllowed: true, isAssigningCategoryStyleAssigned: true }], horizontalZoomable: true, assigningCategoryStyle: function (e, ui) { var minOpacity = .3, opacity = 1.0, curr; if (ui.sumAllSeriesHighlightingProgress > 0.0) { var progress = 0; if (ui.highlightingInfo !== null) { progress = ui.highlightingInfo.progress; } progress = progress - ui.sumAllSeriesHighlightingProgress; opacity = minOpacity + (1.0 + progress) * (1.0 - minOpacity); ui.opacity = opacity; ui.highlightingHandled = true; } }, verticalZoomable: true, windowResponse: "immediate" }); // Transiton Duration Slider $("#transitionDurationSlider").slider({ min: 0, max: 5, step: 0.01, value: 2, slide: function (event, ui) { $("#chart").igDataChart("option", "highlightingTransitionDuration", ui.value * 1000 ); $("#transitionDurationLabel").text(ui.value); } }); }); </script> <style type="text/css"> td { vertical-align: top; } .chartElement { padding-bottom: 20px; } .selectionOptions { margin-bottom: 10px; } .sliderBounds { width: 95px; margin: 6px 3px 6px 6px; display: inline-block; } .selectBounds { width: 120px; } </style> <div id="chart" class="chartElement"/> <div style="float: left"> <fieldset id="chartOptions"> <legend>チャート オプション</legend> <div class="optionContainer"> トランジション期間 <br /> <div id="transitionDurationSlider" class="sliderBounds"></div> <label id="transitionDurationLabel">2</label> </div> </fieldset> </div> <div style="float: right" class="Quandl-attribution"> 人口のデータ ソース: <a href="http://www.quandl.com/" target="_blank">Quandl</a> </div> </body> </html>
var data = [//{ "Date": "12/31/2011", "ukPopulation": 62.74, "francePopulation": 65.18 }, { "Date": "12/31/2010", "ukPopulation": 62.26, "francePopulation": 64.82 }, //{ "Date": "12/31/2009", "ukPopulation": 61.81, "francePopulation": 64.48 }, //{ "Date": "12/31/2008", "ukPopulation": 61.39, "francePopulation": 64.13 }, //{ "Date": "12/31/2007", "ukPopulation": 60.98, "francePopulation": 63.78 }, //{ "Date": "12/31/2006", "ukPopulation": 60.59, "francePopulation": 63.39 }, { "Date": "12/31/2005", "ukPopulation": 60.22, "francePopulation": 62.96 }, //{ "Date": "12/31/2004", "ukPopulation": 59.86, "francePopulation": 62.49 }, //{ "Date": "12/31/2003", "ukPopulation": 59.56, "francePopulation": 62.04 }, //{ "Date": "12/31/2002", "ukPopulation": 59.32, "francePopulation": 61.6 }, //{ "Date": "12/31/2001", "ukPopulation": 59.10, "francePopulation": 61.16 }, { "Date": "12/31/2000", "ukPopulation": 58.89, "francePopulation": 60.72 }, //{ "Date": "12/31/1999", "ukPopulation": 58.68, "francePopulation": 60.32 }, //{ "Date": "12/31/1998", "ukPopulation": 58.48, "francePopulation": 60.01 }, //{ "Date": "12/31/1997", "ukPopulation": 58.31, "francePopulation": 59.8 }, //{ "Date": "12/31/1996", "ukPopulation": 58.16, "francePopulation": 59.59 }, { "Date": "12/31/1995", "ukPopulation": 58.01, "francePopulation": 59.38 }, //{ "Date": "12/31/1994", "ukPopulation": 57.86, "francePopulation": 59.18 }, //{ "Date": "12/31/1993", "ukPopulation": 57.71, "francePopulation": 58.96 }, //{ "Date": "12/31/1992", "ukPopulation": 57.58, "francePopulation": 58.71 }, //{ "Date": "12/31/1991", "ukPopulation": 57.42, "francePopulation": 58.43 }, { "Date": "12/31/1990", "ukPopulation": 57.24, "francePopulation": 58.14 }, //{ "Date": "12/31/1989", "ukPopulation": 57.07, "francePopulation": 57.83 }, //{ "Date": "12/31/1988", "ukPopulation": 56.92, "francePopulation": 57.49 }, //{ "Date": "12/31/1987", "ukPopulation": 56.80, "francePopulation": 57.17 }, //{ "Date": "12/31/1986", "ukPopulation": 56.68, "francePopulation": 56.87 }, { "Date": "12/31/1985", "ukPopulation": 56.55, "francePopulation": 56.58 }, //{ "Date": "12/31/1984", "ukPopulation": 56.42, "francePopulation": 56.31 }, //{ "Date": "12/31/1983", "ukPopulation": 56.33, "francePopulation": 56.04 }, //{ "Date": "12/31/1982", "ukPopulation": 56.31, "francePopulation": 55.74 }, //{ "Date": "12/31/1981", "ukPopulation": 56.33, "francePopulation": 55.41 }, { "Date": "12/31/1980", "ukPopulation": 56.31, "francePopulation": 55.1 }, //{ "Date": "12/31/1979", "ukPopulation": 56.24, "francePopulation": 54.82 }, //{ "Date": "12/31/1978", "ukPopulation": 56.19, "francePopulation": 54.58 }, //{ "Date": "12/31/1977", "ukPopulation": 56.19, "francePopulation": 54.34 }, //{ "Date": "12/31/1976", "ukPopulation": 56.21, "francePopulation": 54.1 }, { "Date": "12/31/1975", "ukPopulation": 56.22, "francePopulation": 53.88 }, //{ "Date": "12/31/1974", "ukPopulation": 56.22, "francePopulation": 53.63 }, //{ "Date": "12/31/1973", "ukPopulation": 56.19, "francePopulation": 53.29 }, //{ "Date": "12/31/1972", "ukPopulation": 56.08, "francePopulation": 52.86 }, //{ "Date": "12/31/1971", "ukPopulation": 55.89, "francePopulation": 52.4 }, { "Date": "12/31/1970", "ukPopulation": 55.66, "francePopulation": 51.9 }, //{ "Date": "12/31/1969", "ukPopulation": 55.44, "francePopulation": 51.43 }, //{ "Date": "12/31/1968", "ukPopulation": 55.21, "francePopulation": 51.01 }, //{ "Date": "12/31/1967", "ukPopulation": 54.94, "francePopulation": 50.63 }, //{ "Date": "12/31/1966", "ukPopulation": 54.64, "francePopulation": 50.22 }, { "Date": "12/31/1965", "ukPopulation": 54.34, "francePopulation": 49.79 }, //{ "Date": "12/31/1964", "ukPopulation": 54.00, "francePopulation": 49.32 }, //{ "Date": "12/31/1963", "ukPopulation": 53.65, "francePopulation": 48.81 }, //{ "Date": "12/31/1962", "ukPopulation": 53.25, "francePopulation": 47.97 }, //{ "Date": "12/31/1961", "ukPopulation": 52.80, "francePopulation": 47.11 }, { "Date": "12/31/1960", "ukPopulation": 52.40, "francePopulation": 46.61 } ];