<#@ template language="C#" HostSpecific="True" #>
<#@ output extension=".cshtml" #>
<#@ include file="..\..\ViewHead.cshtml.include.t4" #>
<#@ parameter name="IsVB" type="System.Boolean" #>
@using C1.Web.Mvc.Chart
@using System.Drawing

<#
    if(!Options["UseRemoteBind"] && !string.IsNullOrEmpty(Options["EntitySetName"]))
    {
#>
@model IEnumerable<<#= ViewDataTypeName #>>
<#
    }
#>
<#@ include file="..\..\ClientEvent.include.t4" #>
<#@ include file="Appearance.cshtml.include.t4" #>
<#@ include file="Selection.include.t4" #>
<#@ include file="HeaderFooter.include.t4" #>

<#
    if(Options["ControlType"].Contains("Sunburst"))
    {
#>
@(Html.C1().Sunburst<<#= ViewDataTypeName #>>()<#
        if(!string.IsNullOrEmpty(Options["ChildItemsPath"]))
        {
#>

    .ChildItemsPath("<#= Options["ChildItemsPath"] #>")<#
        }
    }
    else
    {
#>
@(Html.C1().FlexPie()<#
    }

    // Id
    if(!string.IsNullOrEmpty(Options["Id"]))
    {
#>

    .Id("<#= Options["Id"] #>")<#
    }

    if(!string.IsNullOrEmpty(Options["EntitySetName"]))
    {
#>

    .Bind("<#= Options["BindingName"] #>", "<#= Options["Binding"] #>", <#
        if(Options["UseRemoteBind"])
        {
            #>Url.Action("<#= ViewName #>_Read")<#
        }
        else
        {
            #>Model<#
        }
    #>)<#
    }


    // ClientEvents
    foreach (var clientEvent in Options["ClientEvents"])
    {
        if(clientEvent["Handled"])
        {
            var eventName=clientEvent["Name"].Replace("OnClient","");
            eventName = eventName.Substring(0, 1).ToLower() + eventName.Substring(1);
#>

    .<#= clientEvent["Name"] #>("<#= eventName #>")<#
        }
    }

    //HeaderFooter
    GenerateHeaderFooter();

    if(Options["Tooltip"]["IsDirty"])
    {
        var tooltip = Options["Tooltip"];
#>

    .Tooltip(tooltip => tooltip<#
        if(!tooltip["IsContentHtml"])
        {
            #>.IsContentHtml(false)<#
        }
        if(!string.IsNullOrEmpty(tooltip["Content"]))
        {
            Write(".Content(\"" + tooltip["Content"] + "\")");
        }
        if(tooltip["Gap"] != 0)
        {
            #>.Gap(<#= tooltip["Gap"] #>)<#
        }
        if(tooltip["HideDelay"] != 0)
        {
            #>.HideDelay(<#= tooltip["HideDelay"] #>)<#
        }
        if(tooltip["ShowDelay"] != 0)
        {
            #>.ShowDelay(<#= tooltip["ShowDelay"] #>)<#
        }
        if(tooltip["Threshold"] != 0)
        {
            #>.Threshold(<#= tooltip["Threshold"] #>)<#
        }
        #>)<#
    }

    // Selection
    GenerateSelection(true);

    //Legend
    if(Options["Legend"] != "Position.Right")
    {
#>

    .Legend(<#= Options["Legend"] #>)<#
    }

    GenerateAppearance(Options, true);

 #>
)
