Available in the Full Version
Data Chart - Using TypeScript
This sample demonstrates how to create Data Chart in TypeScript using class-based approach for configuring data.
This sample uses CTP (Community Technical Preview) features. The API and behavior may change when these features are released with full support.
Population data from:
U.S. Census Bureau
U.S. Census Bureau
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></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" /> <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> <div id="data-chart"></div> <div class="USCensus-attribution"> Population data from:<br> <a href="http://www.census.gov/" target="_blank">U.S. Census Bureau</a> </div> <script src="/TypeScriptSamples/data-chart/typescript.js"></script> </body> </html>
/// <reference path="/js/typings/jquery.d.ts" /> /// <reference path="/js/typings/jqueryui.d.ts" /> /// <reference path="/js/typings/igniteui.d.ts" /> class CountryPopulation { countryName: string; population2005: number; population1995: number; constructor(inName: string, populationIn1995: number, populationIn2005: number) { this.countryName = inName; this.population2005 = populationIn2005; this.population1995 = populationIn1995; } } var samplePopulation: CountryPopulation[] = []; samplePopulation.push(new CountryPopulation("China", 1216, 1297)); samplePopulation.push(new CountryPopulation("India", 920, 1090)); samplePopulation.push(new CountryPopulation("United States", 266, 295)); samplePopulation.push(new CountryPopulation("Indonesia", 197, 229)); samplePopulation.push(new CountryPopulation("Brazil", 161, 186)); $(function () { $("#data-chart").igDataChart({ width: "80%", height: "400px", title: "Population per Country", subtitle: "Five largest projected populations for 1995 and 2005", dataSource: samplePopulation, axes: [ { name: "NameAxis", type: "categoryX", title: "Country", label: "countryName" }, { name: "PopulationAxis", type: "numericY", minimumValue: 0, title: "Millions of People", } ], series: [ { name: "1995Population", title: "1995", type: "column", isDropShadowEnabled: true, useSingleShadow: false, shadowColor: "#666666", isHighlightingEnabled: true, isTransitionInEnabled: true, xAxis: "NameAxis", yAxis: "PopulationAxis", valueMemberPath: "population1995", showTooltip: true }, { name: "2005Population", title: "2005", type: "column", isDropShadowEnabled: true, useSingleShadow: false, shadowColor: "#666666", isHighlightingEnabled: true, isTransitionInEnabled: true, xAxis: "NameAxis", yAxis: "PopulationAxis", valueMemberPath: "population2005", showTooltip: true }, { name: "categorySeries", type: "categoryToolTipLayer", useInterpolation: false, transitionDuration: 150 }, { name: "crosshairLayer", title: "crosshair", type: "crosshairLayer", useInterpolation: false, transitionDuration: 500 } ] }); })