Available in the Full Version
Data Chart - Axis Title
The axis title feature of the igChart control allows you to add contextual information to the x and y axes of the igChart control. The slider allows you to determine the angle rotation of the axis title.
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 xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Axis Title</title> <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 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" /> <!-- 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/world-energy-production.js"> </script> <script type="text/javascript"> $(function () { $("#chart").igDataChart({ width: "98%", height: "400px", dataSource: lastFiveYears, title: "Energy Production Per Country", subtitle: "The top five Total Primary Energy producers", legend: { element: "columnLegend" }, axes: [{ name: "xAxis", type: "categoryX", label: "Year", title: "Year" }, { name: "EnergyAxis", type: "numericY", title: "Quadrillion Btu" }], series: [{ name: "series1", title: "Canada", type: "column", isHighlightingEnabled: true, isTransitionInEnabled: true, xAxis: "xAxis", yAxis: "EnergyAxis", valueMemberPath: "Canada", tooltipTemplate: "Canada", showTooltip: true }, { name: "series2", title: "Saudi Arabia", type: "column", isHighlightingEnabled: true, isTransitionInEnabled: true, xAxis: "xAxis", yAxis: "EnergyAxis", valueMemberPath: "SaudiArabia", tooltipTemplate: "Saudi Arabia", showTooltip: true }, { name: "series3", title: "Russia", type: "column", isHighlightingEnabled: true, isTransitionInEnabled: true, xAxis: "xAxis", yAxis: "EnergyAxis", valueMemberPath: "Russia", tooltipTemplate: "Russia", showTooltip: true }, { name: "series4", title: "United States", type: "column", isHighlightingEnabled: true, isTransitionInEnabled: true, xAxis: "xAxis", yAxis: "EnergyAxis", valueMemberPath: "UnitedStates", tooltipTemplate: "United States", showTooltip: true }, { name: "series5", title: "China", type: "column", isHighlightingEnabled: true, isTransitionInEnabled: true, xAxis: "xAxis", yAxis: "EnergyAxis", valueMemberPath: "China", tooltipTemplate: "China", showTooltip: true }] }); //yAxis Angle Transiton Duration Slider $("#yAxisAngleSlider").slider({ min: -180, max: 180, value: -90, slide: function (event, ui) { $("#chart").igDataChart("option", "axes", [{ name: "EnergyAxis", titleAngle: ui.value}]); $("#yAxisAngleLabel").text(ui.value); } }); //xAxis Angle Transiton Duration Slider $("#xAxisAngleSlider").slider({ min: -180, max: 180, value: -90, slide: function (event, ui) { $("#chart").igDataChart("option", "axes", [{ name: "xAxis", titleAngle: ui.value }]); $("#xAxisAngleLabel").text(ui.value); } }); }); </script> <style type="text/css"> td { vertical-align: top; } .chartElement { padding-bottom: 20px; } .optionsPane { position: relative; float: initial; width: 250px; margin: 6px 3px 6px 6px; display: inline-block; padding-top: 18px; } .optionsColumn { float: left; /*width: 250px;*/ position: relative; margin: 2px; padding: 2px; display: inline-block; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; border: 1px solid #e0e0e0; } .slider { width: 250px; margin: 10px 10px 4px 6px; padding-right: 3px; padding-left: 3px; display: inline-block; float: left; } .values { padding-left: 7px; padding-right: 0px; } </style> <table><tr> <td id="chart" class="chartElement"></td> <td id="columnLegend" style="float: left"></td></tr></table> <div class="EIA-attribution"> Energy data from:<br /> <a href="http://www.eia.gov" target="_blank">U.S. Energy Information Administration (September 2012) </a> </div> <br/> <div> <div class="optionsPane"> <div class="optionsColumn"> <div> <label>Rotate Y Axis</label> <label id="yAxisAngleLabel" class="values">-90</label> <div id="yAxisAngleSlider" class="slider"></div> </div> </div> <div class="optionsColumn"> <div> <label>Rotate X Axis</label> <label id="xAxisAngleLabel" class="values">0</label> <div id="xAxisAngleSlider" class="slider"></div> </div> </div> </div> </div> </body> </html>
/* Data from U.S. Energy Information Administration (2012) */ var data = [ { "Year": 1995, "Canada": 16.8331, "SaudiArabia": 20.6591, "Russia": 41.4181, "UnitedStates": 71.1744, "China": 33.5387, }, { "Year": 1996, "Canada": 17.2262, "SaudiArabia": 20.8153, "Russia": 39.9461, "UnitedStates": 72.4860, "China": 35.1037, }, { "Year": 1997, "Canada": 17.4787, "SaudiArabia": 21.2433, "Russia": 38.7414, "UnitedStates": 72.4715, "China": 38.4407, }, { "Year": 1998, "Canada": 17.4377, "SaudiArabia": 21.4151, "Russia": 39.0652, "UnitedStates": 72.8764, "China": 38.8876, }, { "Year": 1999, "Canada": 17.6813, "SaudiArabia": 20.1783, "Russia": 40.8088, "UnitedStates": 71.7420, "China": 37.5003, }, { "Year": 2000, "Canada": 18.1283, "SaudiArabia": 21.5931, "Russia": 41.6954, "UnitedStates": 71.3322, "China": 38.7841, }, { "Year": 2001, "Canada": 18.0215, "SaudiArabia": 20.9456, "Russia": 42.6263, "UnitedStates": 71.7343, "China": 41.6730, }, { "Year": 2002, "Canada": 18.3578, "SaudiArabia": 20.2696, "Russia": 44.1627, "UnitedStates": 70.7132, "China": 46.2297, }, { "Year": 2003, "Canada": 18.3074, "SaudiArabia": 23.0489, "Russia": 47.1823, "UnitedStates": 69.9627, "China": 51.2491, }, { "Year": 2004, "Canada": 18.6642, "SaudiArabia": 24.1590, "Russia": 49.8648, "UnitedStates": 70.2224, "China": 55.9233, }, { "Year": 2005, "Canada": 18.8932, "SaudiArabia": 25.4401, "Russia": 51.0796, "UnitedStates": 69.4437, "China": 63.9524, }, { "Year": 2006, "Canada": 19.2273, "SaudiArabia": 24.6105, "Russia": 52.0557, "UnitedStates": 70.7539, "China": 68.2333, }, { "Year": 2007, "Canada": 19.5439, "SaudiArabia": 23.7326, "Russia": 52.5599, "UnitedStates": 71.4000, "China": 73.2809, }, { "Year": 2008, "Canada": 19.0196, "SaudiArabia": 25.1682, "Russia": 52.5460, "UnitedStates": 73.2178, "China": 78.3599, }, { "Year": 2009, "Canada": 18.3249, "SaudiArabia": 22.837, "Russia": 50.4291, "UnitedStates": 72.6409, "China": 84.0643, }, { "Year": 2010, "Canada": 18.3358, "SaudiArabia": 24.7442, "Russia": 53.2232, "UnitedStates": 74.7951, "China": 90.3918, }, ]; var lastFiveYears = [ { "Year": 2005, "Canada": 18.8932, "SaudiArabia": 25.4401, "Russia": 51.0796, "UnitedStates": 69.4437, "China": 63.9524, }, { "Year": 2006, "Canada": 19.2273, "SaudiArabia": 24.6105, "Russia": 52.0557, "UnitedStates": 70.7539, "China": 68.2333, }, { "Year": 2007, "Canada": 19.5439, "SaudiArabia": 23.7326, "Russia": 52.5599, "UnitedStates": 71.4000, "China": 73.2809, }, { "Year": 2008, "Canada": 19.0196, "SaudiArabia": 25.1682, "Russia": 52.5460, "UnitedStates": 73.2178, "China": 78.3599, }, { "Year": 2009, "Canada": 18.3249, "SaudiArabia": 22.837, "Russia": 50.4291, "UnitedStates": 72.6409, "China": 84.0643, }, { "Year": 2010, "Canada": 18.3358, "SaudiArabia": 24.7442, "Russia": 53.2232, "UnitedStates": 74.7951, "China": 90.3918, } ]; var everyThreeYears = [ { "Year": 1995, "Canada": 16.8331, "SaudiArabia": 20.6591, "Russia": 41.4181, "UnitedStates": 71.1744, "China": 33.5387, }, { "Year": 1998, "Canada": 17.4377, "SaudiArabia": 21.4151, "Russia": 39.0652, "UnitedStates": 72.8764, "China": 38.8876, }, { "Year": 2001, "Canada": 18.0215, "SaudiArabia": 20.9456, "Russia": 42.6263, "UnitedStates": 71.7343, "China": 41.6730, }, { "Year": 2004, "Canada": 18.6642, "SaudiArabia": 24.1590, "Russia": 49.8648, "UnitedStates": 70.2224, "China": 55.9233, }, { "Year": 2007, "Canada": 19.5439, "SaudiArabia": 23.7326, "Russia": 52.5599, "UnitedStates": 71.4000, "China": 73.2809, }, { "Year": 2010, "Canada": 18.3358, "SaudiArabia": 24.7442, "Russia": 53.2232, "UnitedStates": 74.7951, "China": 90.3918, }, ];