Available in the Full Version
Data Chart - Category Highlight Layer
This sample demonstrates the Category Highlight Layer that targets a category axis, or all category axes in the igChart control. The sample options pane allows you to edit the properties of the Category Highlight Layer, such as changing the color of the highlight, outline, thickness and more.
This sample uses CTP (Community Technical Preview) features. The API and behavior may change when these features are released with full support.
This sample is designed for a larger screen size.
On mobile, try rotating your screen, view full size, or email to another device.
Code View
Copy to Clipboard
<!DOCTYPE html> <html> <head> <title>Category Highlight Layer</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> <style type="text/css"> .sliderBounds { width: 95px; margin: 6px 3px 6px 6px; display: inline-block; } .optionContainer { width: 200px; margin: 2px; padding: 2px; display: inline-block; border: 1px solid #e0e0e0; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } .selectBounds { min-width: 120px; max-width: 132px; } </style> <div id="chart"></div> <br/> <div> <fieldset id="chartOptions"> <legend>Category Item Highlight Options</legend> <br /> <div class="optionContainer"> Brush <br /> <select id="brush" class="selectBounds"> <option value="red">Red</option> <option value="blue">Blue</option> <option value="green">Green</option> <option value="yellow">Yellow</option> <option value="black">Black</option> <option value="orange" selected="selected">Orange</option> </select> </div> <div class="optionContainer"> Outline <br /> <select id="outline" class="selectBounds"> <option value="red">Red</option> <option value="blue">Blue</option> <option value="green">Green</option> <option value="yellow">Yellow</option> <option value="black" selected="selected">Black</option> </select> </div> <div class="optionContainer"> Thickness <br /> <div id="thicknessSlider" class="sliderBounds"></div> <label id="thicknessLabel">1</label> </div> <div class="optionContainer"> Opacity <br /> <div id="opacitySlider" class="sliderBounds"></div> <label id="opacityLabel">0.3</label> </div> <br/> <div class="optionContainer"> Transition Duration <br /> <div id="transitionDurationSlider" class="sliderBounds"></div> <label id="transitionDurationLabel">150</label> </div> <div class="optionContainer"> <input type="checkbox" id="useInterpolationCheckBox" />Use Interpolation<br /> </div> </fieldset> </div> <br/> <div class="USCensus-attribution"> Population data from:<br /> <a href="http://www.census.gov/" target="_blank">U.S. Census Bureau</a> </div> <script> $(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: "Population per Country", subtitle: "A comparison of population in 1995 and 2005", dataSource: data, axes: [ { name: "NameAxis", type: "categoryX", title: "Country", label: "CountryName" }, { name: "PopulationAxis", type: "numericY", minimumValue: 0, title: "Millions of People", } ], series: [ { name: "2005Population", type: "column", isTransitionInEnabled: true, xAxis: "NameAxis", yAxis: "PopulationAxis", valueMemberPath: "Pop2005" }, { name: "1995Population", type: "column", isTransitionInEnabled: true, xAxis: "NameAxis", yAxis: "PopulationAxis", valueMemberPath: "Pop1995" }, { name: "catHighlightLayer", title: "categoryHighlight", type: "categoryHighlightLayer", useInterpolation: true, transitionDuration: 250, thickness: 1, opacity: 0.3, brush: "orange", outline: "black" }] }); // Brush $("#brush").on({ change: function (e) { var brushColor = $(this).val(); $("#chart").igDataChart("option", "series", [{ name: "catHighlightLayer", brush: brushColor }]); } }); // Outline $("#outline").on({ change: function (e) { var outlineColor = $(this).val(); $("#chart").igDataChart("option", "series", [{ name: "catHighlightLayer", outline: outlineColor }]); } }); // Thickness $("#thicknessSlider").slider({ min: 1, max: 4, value: 1, step: 1, slide: function (event, ui) { $("#chart").igDataChart("option", "series", [{ name: "catHighlightLayer", thickness: ui.value }]); $("#thicknessLabel").text(ui.value); } }); // Opacity $("#opacitySlider").slider({ min: 0, max: 1, value: 0.5, step: 0.01, slide: function (event, ui) { $("#chart").igDataChart("option", "series", [{ name: "catHighlightLayer", opacity: ui.value }]); $("#opacityLabel").text(ui.value); } }); // Transition Duration Slider $("#transitionDurationSlider").slider({ min: 0, max: 1000, value: 150, step: 50, slide: function (event, ui) { $("#chart").igDataChart("option", "series", [{ name: "catHighlightLayer", transitionDuration: ui.value }]); $("#transitionDurationLabel").text(ui.value); } }); // Use Interpolation $("#useInterpolationCheckBox").click(function (e) { var useInterpolationResult = $("#useInterpolationCheckBox").is(":checked") ? true : false; $("#chart").igDataChart("option", "series", [{ name: "catHighlightLayer", useInterpolation: useInterpolationResult }]); }); }); </script> </body> </html>