Available in the Full Version
Pie Chart - Overview
The igPieChart is a charting control for rendering pie charts in HTML5 Web applications and sites.
It uses the new HTML5 canvas tag to plot pie charts on web pages.
The main features of igPieChart include
legend, tooltips based on templates, controlling pie radius, controlling pie label
position, start angle, sweep direction, exploded slices and distance from center for exploded slices.
See the complete list of samples in the menu.
This sample uses CTP (Community Technical Preview) features. The API and behavior may change when these features are released with full support.
Start Angle: | |
Radius: | |
Exploded Radius | |
Label Extent | |
Label Position: |
|
Leader Line: |
|
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
data = [{ "Budget": 60, "Label": "Administration" }, { "Budget": 40, "Label": "Sales" }, { "Budget": 60, "Label": "IT" }, { "Budget": 40, "Label": "Marketing" }, { "Budget": 60, "Label": "Development" }, { "Budget": 20, "Label": "Support" }]; $('#chart').igPieChart({ dataSource: data, width: '430px', height: '430px', valueMemberPath: 'Budget', labelMemberPath: 'Label', explodedSlices: [2, 3], radiusFactor: .6, labelsPosition: "outsideEnd", leaderLineType: "arc", labelExtent: 40, legend: { element: 'legend', type: "item" } }); $("#angle").slider({ slide: function (event, ui) { $("#chart").igPieChart("option", "startAngle", ui.value); }, min: 0, max: 360 }); $("#radius").slider({ slide: function (event, ui) { $("#chart").igPieChart("option", "radiusFactor", ui.value / 1000.0); }, min: 0, max: 1000, value: 600 }); $("#labelExtent").slider({ slide: function (event, ui) { $("#chart").igPieChart("option", "labelExtent", ui.value); }, min: 0, max: 50, value: 40 }); $("#explodedRadius").slider({ slide: function (event, ui) { $("#chart").igPieChart("option", "explodedRadius", ui.value / 100); }, min: 0, max: 100, value: 20 }); $("#labelPosition").igCombo({ enableClearButton: false, mode: "dropdown", selectionChanged: function (evt, ui) { if ($.isArray(ui.items) && ui.items[0] != undefined) { $("#chart").igPieChart("option", "labelsPosition", ui.items[0].data.value); $("#labelExtent").slider("option", "disabled", ui.items[0].data.value != "outsideEnd"); $("#leaderLine").igCombo("option", "disabled", ui.items[0].data.value != "outsideEnd" ? true : false); } } }); $("#leaderLine").igCombo({ enableClearButton: false, mode: "dropdown", selectionChanged: function (evt, ui) { if ($.isArray(ui.items) && ui.items[0] != undefined) { $("#chart").igPieChart("option", "leaderLineType", ui.items[0].data.value); } } });
<!-- Widget target elements --> <div id="chart"></div> <div id="legend"></div> <table class="options"> <tr> <td>Start Angle:</td> <td> <div id="angle" class="slider"></div> </td> </tr> <tr> <td>Radius:</td> <td> <div id="radius" class="slider"></div> </td> </tr> <tr> <td>Exploded Radius</td> <td> <div id="explodedRadius" class="slider"></div> </td> </tr> <tr> <td>Label Extent</td> <td> <div id="labelExtent" class="slider"></div> </td> </tr> <tr> <td>Label Position:</td> <td> <div class="comboContainer"> <select id="labelPosition"> <option value="none">None</option> <option value="center">Center</option> <option value="insideEnd">Inside End</option> <option value="outsideEnd" selected="selected">Outside End</option> <option value="bestFit">Best Fit</option> </select> </div> </td> </tr> <tr> <td>Leader Line:</td> <td> <div class="comboContainer"> <select id="leaderLine"> <option value="straight">Straight</option> <option value="arc" selected="selected">Arc</option> <option value="spline">Spline</option> </select> </div> </td> </tr> </table>
#chart { display:inline-block; position: relative; float: left; margin-right: 10px; margin-bottom: 10px; } #legend { display:inline-block; } .options { margin-top: 20px; } .slider { width: 200px; height: 10px; margin: 10px; }
<!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 { display:inline-block; position: relative; float: left; margin-right: 10px; margin-bottom: 10px; } #legend { display:inline-block; } .options { margin-top: 20px; } .slider { width: 200px; height: 10px; margin: 10px; } </style> <!-- Widget target elements --> <div id="chart"></div> <div id="legend"></div> <table class="options"> <tr> <td>Start Angle:</td> <td> <div id="angle" class="slider"></div> </td> </tr> <tr> <td>Radius:</td> <td> <div id="radius" class="slider"></div> </td> </tr> <tr> <td>Exploded Radius</td> <td> <div id="explodedRadius" class="slider"></div> </td> </tr> <tr> <td>Label Extent</td> <td> <div id="labelExtent" class="slider"></div> </td> </tr> <tr> <td>Label Position:</td> <td> <div class="comboContainer"> <select id="labelPosition"> <option value="none">None</option> <option value="center">Center</option> <option value="insideEnd">Inside End</option> <option value="outsideEnd" selected="selected">Outside End</option> <option value="bestFit">Best Fit</option> </select> </div> </td> </tr> <tr> <td>Leader Line:</td> <td> <div class="comboContainer"> <select id="leaderLine"> <option value="straight">Straight</option> <option value="arc" selected="selected">Arc</option> <option value="spline">Spline</option> </select> </div> </td> </tr> </table> <script> $(function () { data = [{ "Budget": 60, "Label": "Administration" }, { "Budget": 40, "Label": "Sales" }, { "Budget": 60, "Label": "IT" }, { "Budget": 40, "Label": "Marketing" }, { "Budget": 60, "Label": "Development" }, { "Budget": 20, "Label": "Support" }]; $('#chart').igPieChart({ dataSource: data, width: '430px', height: '430px', valueMemberPath: 'Budget', labelMemberPath: 'Label', explodedSlices: [2, 3], radiusFactor: .6, labelsPosition: "outsideEnd", leaderLineType: "arc", labelExtent: 40, legend: { element: 'legend', type: "item" } }); $("#angle").slider({ slide: function (event, ui) { $("#chart").igPieChart("option", "startAngle", ui.value); }, min: 0, max: 360 }); $("#radius").slider({ slide: function (event, ui) { $("#chart").igPieChart("option", "radiusFactor", ui.value / 1000.0); }, min: 0, max: 1000, value: 600 }); $("#labelExtent").slider({ slide: function (event, ui) { $("#chart").igPieChart("option", "labelExtent", ui.value); }, min: 0, max: 50, value: 40 }); $("#explodedRadius").slider({ slide: function (event, ui) { $("#chart").igPieChart("option", "explodedRadius", ui.value / 100); }, min: 0, max: 100, value: 20 }); $("#labelPosition").igCombo({ enableClearButton: false, mode: "dropdown", selectionChanged: function (evt, ui) { if ($.isArray(ui.items) && ui.items[0] != undefined) { $("#chart").igPieChart("option", "labelsPosition", ui.items[0].data.value); $("#labelExtent").slider("option", "disabled", ui.items[0].data.value != "outsideEnd"); $("#leaderLine").igCombo("option", "disabled", ui.items[0].data.value != "outsideEnd" ? true : false); } } }); $("#leaderLine").igCombo({ enableClearButton: false, mode: "dropdown", selectionChanged: function (evt, ui) { if ($.isArray(ui.items) && ui.items[0] != undefined) { $("#chart").igPieChart("option", "leaderLineType", ui.items[0].data.value); } } }); }); </script> </body> </html>