/// <reference path="~/GeneratedArtifacts/viewModel.js" />
/// <reference path="../Scripts/wijmo.cba.js" />

myapp.PieGettingStarted.FlexPie_render = function (element, contentItem) {
    var pie = new c1.cba.FlexPie($(element), contentItem);
    var collectionView = new c1.cba.LightSwitchCollectionView(contentItem);
    pie.wjControl.itemsSource = collectionView;
    myapp.pie = pie.wjControl;
};


myapp.PieGettingStarted.InnerRadius_render = function (element, contentItem) {
    $("<select><option>0</option><option>0.25</option><option>0.5</option><option>0.75</option></select>")
   .appendTo($(element))
   .change(function () {
       myapp.pie.innerRadius = Number($(this).val());
   });
};

myapp.PieGettingStarted.Offset_render = function (element, contentItem) {
    $("<select><option>0</option><option>0.1</option><option>0.2</option><option>0.3</option><option>0.4</option><option>0.5</option></select>")
   .appendTo($(element))
   .change(function () {
       myapp.pie.offset = Number($(this).val());
   });
};

myapp.PieGettingStarted.StartAngle_render = function (element, contentItem) {
    $("<select><option>0</option><option>90</option><option>180</option><option>-90</option></select>")
   .appendTo($(element))
   .change(function () {
       myapp.pie.startAngle = Number($(this).val());
   });
};

myapp.PieGettingStarted.Reversed_render = function (element, contentItem) {
    $("<select><option>False</option><option>True</option></select>")
    .appendTo($(element))
    .change(function () {
        myapp.pie.reversed = $(this).val() === "True";
    });
};

myapp.PieGettingStarted.Palette_render = function (element, contentItem) {
    $("<select><option>standard</option><option>cocoa</option><option>coral</option><option>dark</option><option>highcontrast</option><option>light</option><option>midnight</option><option>minimal</option><option>modern</option><option>organic</option><option>slate</option></select>")
    .appendTo($(element))
    .change(function () {
        myapp.pie.palette = wijmo.chart.Palettes[$(this).val()];
    });
};

myapp.PieGettingStarted.DataLabelPosition_render = function (element, contentItem) {
    $("<select><option>None</option><option>Inside</option><option>Center</option><option>Outside</option></select>")
   .appendTo($(element))
   .change(function () {
       myapp.pie.dataLabel.position = $(this).val();
   });
};

myapp.PieGettingStarted.DataLabelBorder_render = function (element, contentItem) {
    $("<select><option>False</option><option>True</option></select>")
    .appendTo($(element))
    .change(function () {
        myapp.pie.dataLabel.border = $(this).val() === "True";
    });
};