Available in the Full Version
Pie Chart - XML Binding
This is a basic example for binding the pie chart to an XML string.
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></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> <script src="http://cdn-na.infragistics.com/igniteui/2024.1/latest/js/infragistics.lob.js"></script> </head> <body> <style type="text/css"> #chart { position: relative; float: left; margin-right: 10px; margin-bottom: 10px; } </style> <div id="chart"></div> <script> $(function () { //Sample XML Data var xmlDoc = '<Countries>' + '<Country Name="China" Population="1333" />' + '<Country Name="India" Population="1140" />' + '<Country Name="United States" Population="304" />' + '<Country Name="Indonesia" Population="228" />' + '<Country Name="Brazil" Population="192" />' + '</Countries>'; //Binding to XML requires a schema to define data fields var xmlSchema = new $.ig.DataSchema("xml", { //searchField serves as the base node(s) for the XPaths searchField: "//Country", fields: [ { name: "Name", xpath: "./@Name" }, { name: "Population", xpath: "./@Population", type: "number" }, ] } ); //This creates an Infragistics datasource from the XML //and the Schema which can be consumed by the grid. var ds = new $.ig.DataSource({ type: "xml", dataSource: xmlDoc, schema: xmlSchema }); $("#chart").igPieChart({ width: "435px", height: "435px", dataSource: ds, valueMemberPath: "Population", labelMemberPath: "Name", labelsPosition: "bestFit" }); }); </script> </body> </html>