@using Trirand.Web.Mvc
@using System.Collections.Generic;
@using Trirand.Web.Mvc.Chart;
@using Trirand.Web.Mvc.Chart.Series;
@using Trirand.Web.Mvc.Chart.Series.Data;
@using Trirand.Web.Mvc.Chart.Style;

<!DOCTYPE html>
<html lang="en-us">
<head>
    <meta charset="utf-8">
    <title>Chartfor ASP.NET MVC - Pie Simple</title>  
    <script type="text/javascript" src="~/Scripts/trirand/chart/corechart.min.js"></script>
</head>
<body>
    <div>
        <!--
        The Html.Trirand().CoreChart() helper has two parameters
            - the model of the chart -- all chart properties, data and settings
            - the ID of the chart -- can be used for client-side manipulation
        In this example we are using hardcoded model in the View, but you can contruct the model in 
        the controller based on runtime criteria and database data and pass the model 
        to the View using ViewData
        -->
        @(Html.Trirand().CoreChart(
            new CoreChart
            {
                Title = new List<Title>
                {
                    new Title()
                    {
                        Left = "center",
                        Text = "Customized Pie",
                        Top = 20,
                        TextStyle = new TextStyle
                        {
                            Color = "#ccc"
                        }
                    }
                },
                Tooltip = new ToolTip
                {
                    Trigger = TriggerType.Item,
                    Formatter = "{a} <br/>{b} : {c} ({d}%)"
                },
                Legend = new Legend
                {
                    Orient = OrientType.Vertical,
                    Left = "left",
                    Data = ViewData["legendData"] as List<string>,

                },

                Series = new List<object>()
                {
                    new Pie()
                    {
                        Name = "Access Source",
                        Radius = "55%",
                        Center = new List<string>() {"50%", "50%"},
                        Data = ViewData["pieData"] as List<PieData<int>>,
                        
                        ItemStyle = new ItemStyle
                        {
                            Normal = new Normal
                            {
                                ShadowBlur = 10,
                                ShadowOffsetX = 0,
                                ShadowColor = "rgba(0, 0, 0, 0.5)"
                            }
                        },
                    },
                }
            }
            , "Chart")
        )
             
        <br />
        <div>
             
        </div>
    </div>
</body>
</html>

using System.Web.Mvc;
using System.Collections.Generic;
using Trirand.Web.Mvc.Chart.Series.Data;

namespace CoreDemo.Controllers.Chart
{
    public partial class ChartController : Controller
    {
        public ActionResult Simple()
        {
            List<PieData<int>> pieData = new List<PieData<int>>
            {
                new PieData<int> { Name = "Interview", Value = 335},
                new PieData<int> { Name = "Mail", Value = 310},
                new PieData<int> { Name = "Affiliate", Value = 274},
                new PieData<int> { Name = "Video", Value = 235},
                new PieData<int> { Name = "Search", Value = 400}
            };

            List<string> legendData = new List<string>() { "Interview", "Mail", "Affiliate", "Video", "Search" };

            ViewData["pieData"] = pieData;
            ViewData["legendData"] = legendData;

            return View("");
        }
    }
}