/// <reference path="/js/typings/jquery.d.ts" />
/// <reference path="/js/typings/jqueryui.d.ts" />
/// <reference path="/js/typings/igniteui.d.ts" />
class PieChartCountryPopulation {
countryName: string;
population2008: number;
constructor(inName: string, populationIn2008: number) {
this.countryName = inName;
this.population2008 = populationIn2008;
}
}
var pieChartSample: PieChartCountryPopulation[] = [];
pieChartSample.push(new PieChartCountryPopulation("China", 1333));
pieChartSample.push(new PieChartCountryPopulation("India", 1140));
pieChartSample.push(new PieChartCountryPopulation("United States", 304));
pieChartSample.push(new PieChartCountryPopulation("Indonesia", 228));
pieChartSample.push(new PieChartCountryPopulation("Brazil", 192));
$(function () {
$('#pieChart').igPieChart({
dataSource: pieChartSample,
width: "430px",
height: "430px",
dataLabel: 'countryName',
dataValue: 'population2008',
explodedSlices: [2, 3, 4],
radiusFactor: .6,
startAngle: -30,
labelsPosition: "outsideEnd",
leaderLineType: "straight",
labelExtent: 40,
legend: { element: 'legend', type: "item" }
});
$("#angle").slider({
slide: function (event, ui) {
$("#pieChart").igPieChart("option", "startAngle", ui.value);
},
min: 0,
max: 360
});
$("#radius").slider({
slide: function (event, ui) {
$("#pieChart").igPieChart("option", "radiusFactor", ui.value / 1000.0);
},
min: 0,
max: 1000,
value: 600
});
$("#labelPosition").igCombo({
enableClearButton: false,
mode: "dropdown",
selectionChanged: function (evt, ui) {
if ($.isArray(ui.items) && ui.items[0] != undefined) {
$("#pieChart").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) {
$("#pieChart").igPieChart("option", "leaderLineType", ui.items[0].data.value);
}
}
});
});