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

myapp.ChartBinding.FlexChart_render = function (element, contentItem) {
    var chart = new c1.cba.FlexChart($(element), contentItem);
    var collectionView = new c1.cba.LightSwitchCollectionView(contentItem);
    chart.wjControl.itemsSource = collectionView;
    myapp.chart = chart.wjControl;
};

myapp.ChartBinding.ChartType_render = function (element, contentItem) {
    $("<select><option>Line</option><option>LineSymbols</option><option>Area</option></select>")
    .appendTo($(element))
    .change(function () {
        myapp.chart.chartType = $(this).val();
    });
};
myapp.ChartBinding.InterpolateNulls_render = function (element, contentItem) {
    $("<select><option>True</option><option>False</option></select>")
    .appendTo($(element))
    .change(function () {
        myapp.chart.interpolateNulls = $(this).val() === "True";
    });
};
myapp.ChartBinding.LegendToggle_render = function (element, contentItem) {
    $("<select><option>True</option><option>False</option></select>")
    .appendTo($(element))
    .change(function () {
        myapp.chart.legendToggle = $(this).val() === "True";
    });
};
