@using Trirand.Web.Mvc
@using Trirand.Web.Mvc.Chart;
@using Trirand.Web.Mvc.Chart.Series;
@using Trirand.Web.Mvc.Chart.Style;
@using Newtonsoft.Json.Linq;
@using Trirand.Web.Mvc.Chart.ChartFeature;
@using Trirand.Web.Mvc.Chart.Data

<!DOCTYPE html>
<html lang="en-us">
<head>
    <meta charset="utf-8">
    <title>Chartfor ASP.NET MVC - Map - World Map</title>
    <script type="text/javascript" src="~/Scripts/trirand/chart/corechart.min.js"></script>
    <script type="text/javascript" src="~/Scripts/trirand/chart/maps/world.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
                        {
                            Width = "900px",
                            Height = "500px",
                            Title = new List<Title>
                            {
                                new Title()
                                {
                                    Top = "top",
                                    Left = "center",
                                    Text = "World Population 2010",
                                    Subtext = "from United Nations, Total population, both sexes combined, as of 1 July (thousands)",
                                    Sublink = "http://esa.un.org/wpp/Excel-Data/population.htm"
                                }
                            },
                            Tooltip = new ToolTip
                            {
                                Formatter = new JRaw(@"function (params) {
                                                            var value = (params.value + '').split('.');
                                                            value = value[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,')
                                                                    + '.' + value[1];
                                                            return params.seriesName + '<br/>' + params.name + ' : ' + value;
                                                        }")
                            },
                            Toolbox = new ToolBox
                            {
                                Show = true,
                                Orient = OrientType.Vertical,
                                Left = "right",
                                Top = "center",
                                Feature = new Feature
                                {
                                    DataView = new DataView {  ReadOnly = false},
                                    Restore = new Restore { },
                                    SaveAsImage = new FeatureImage { }
                                }

                            },
                            VisualMap = new VisualMap
                            {
                                Min = 0,
                                Max = 1000000,
                                Text = new List<string> { "High", "Low" },
                                Calculable = true,
                                Top = 60,
                                Left = 10,

                            },
                            Series = new List<object>()
                            {
                                new Map
                                {
                                    Name = "World Population 2010",
                                    MapType = "world",
                                    Roam = true,
                                    ItemStyle = new ItemStyle { Emphasis = new Emphasis { Label = new StyleLabel { Show = true } }},
                                    Data = ViewData["data1"] as List<Data>
                                }
                            }
                        }
            , "myChart")
        )
   


        <br />
        <div>
             
        </div>
    </div>
</body>
</html>

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

namespace CoreDemo.Controllers.Chart
{
    public partial class ChartController : Controller
    {
        public ActionResult WorldMap()
        {
            List<Data> data1 = new List<Data>
            {
                new Data {Name= "Afghanistan", Value= 28397.812},
                new Data {Name= "Angola", Value= 19549.124},
                new Data {Name= "Albania", Value= 3150.143},
                new Data {Name= "United Arab Emirates", Value= 8441.537},
                new Data {Name= "Argentina", Value= 40374.224},
                new Data {Name= "Armenia", Value= 2963.496},
                new Data {Name= "French Southern and Antarctic Lands", Value= 268.065},
                new Data {Name= "Australia", Value= 22404.488},
                new Data {Name= "Austria", Value= 8401.924},
                new Data {Name= "Azerbaijan", Value= 9094.718},
                new Data {Name= "Burundi", Value= 9232.753},
                new Data {Name= "Belgium", Value= 10941.288},
                new Data {Name= "Benin", Value= 9509.798},
                new Data {Name= "Burkina Faso", Value= 15540.284},
                new Data {Name= "Bangladesh", Value= 151125.475},
                new Data {Name= "Bulgaria", Value= 7389.175},
                new Data {Name= "The Bahamas", Value= 66402.316},
                new Data {Name= "Bosnia and Herzegovina", Value= 3845.929},
                new Data {Name= "Belarus", Value= 9491.07},
                new Data {Name= "Belize", Value= 308.595},
                new Data {Name= "Bermuda", Value= 64.951},
                new Data {Name= "Bolivia", Value= 716.939},
                new Data {Name= "Brazil", Value= 195210.154},
                new Data {Name= "Brunei", Value= 27.223},
                new Data {Name= "Bhutan", Value= 716.939},
                new Data {Name= "Botswana", Value= 1969.341},
                new Data {Name= "Central African Republic", Value= 4349.921},
                new Data {Name= "Canada", Value= 34126.24},
                new Data {Name= "Switzerland", Value= 7830.534},
                new Data {Name= "Chile", Value= 17150.76},
                new Data {Name= "China", Value= 1359821.465},
                new Data {Name= "Ivory Coast", Value= 60508.978},
                new Data {Name= "Cameroon", Value= 20624.343},
                new Data {Name= "Democratic Republic of the Congo", Value= 62191.161},
                new Data {Name= "Republic of the Congo", Value= 3573.024},
                new Data {Name= "Colombia", Value= 46444.798},
                new Data {Name= "Costa Rica", Value= 4669.685},
                new Data {Name= "Cuba", Value= 11281.768},
                new Data {Name= "Northern Cyprus", Value= 1.468},
                new Data {Name= "Cyprus", Value= 1103.685},
                new Data {Name= "Czech Republic", Value= 10553.701},
                new Data {Name= "Germany", Value= 83017.404},
                new Data {Name= "Djibouti", Value= 834.036},
                new Data {Name= "Denmark", Value= 5550.959},
                new Data {Name= "Dominican Republic", Value= 10016.797},
                new Data {Name= "Algeria", Value= 37062.82},
                new Data {Name= "Ecuador", Value= 15001.072},
                new Data {Name= "Egypt", Value= 78075.705},
                new Data {Name= "Eritrea", Value= 5741.159},
                new Data {Name= "Spain", Value= 46182.038},
                new Data {Name= "Estonia", Value= 1298.533},
                new Data {Name= "Ethiopia", Value= 87095.281},
                new Data {Name= "Finland", Value= 5367.693},
                new Data {Name= "Fiji", Value= 860.559},
                new Data {Name= "Falkland Islands", Value= 49.581},
                new Data {Name= "France", Value= 63230.866},
                new Data {Name= "Gabon", Value= 1556.222},
                new Data {Name= "United Kingdom", Value= 62066.35},
                new Data {Name= "Georgia", Value= 4388.674},
                new Data {Name= "Ghana", Value= 24262.901},
                new Data {Name= "Guinea", Value= 10876.033},
                new Data {Name= "Gambia", Value= 1680.64},
                new Data {Name= "Guinea Bissau", Value= 10876.033},
                new Data {Name= "Equatorial Guinea", Value= 696.167},
                new Data {Name= "Greece", Value= 11109.999},
                new Data {Name= "Greenland", Value= 56.546},
                new Data {Name= "Guatemala", Value= 14341.576},
                new Data {Name= "French Guiana", Value= 231.169},
                new Data {Name= "Guyana", Value= 786.126},
                new Data {Name= "Honduras", Value= 7621.204},
                new Data {Name= "Croatia", Value= 4338.027},
                new Data {Name= "Haiti", Value= 9896.4},
                new Data {Name= "Hungary", Value= 10014.633},
                new Data {Name= "Indonesia", Value= 240676.485},
                new Data {Name= "India", Value= 1205624.648},
                new Data {Name= "Ireland", Value= 4467.561},
                new Data {Name= "Iran", Value= 240676.485},
                new Data {Name= "Iraq", Value= 30962.38},
                new Data {Name= "Iceland", Value= 318.042},
                new Data {Name= "Israel", Value= 7420.368},
                new Data {Name= "Italy", Value= 60508.978},
                new Data {Name= "Jamaica", Value= 2741.485},
                new Data {Name= "Jordan", Value= 6454.554},
                new Data {Name= "Japan", Value= 127352.833},
                new Data {Name= "Kazakhstan", Value= 15921.127},
                new Data {Name= "Kenya", Value= 40909.194},
                new Data {Name= "Kyrgyzstan", Value= 5334.223},
                new Data {Name= "Cambodia", Value= 14364.931},
                new Data {Name= "South Korea", Value= 51452.352},
                new Data {Name= "Kosovo", Value= 97.743},
                new Data {Name= "Kuwait", Value= 2991.58},
                new Data {Name= "Laos", Value= 6395.713},
                new Data {Name= "Lebanon", Value= 4341.092},
                new Data {Name= "Liberia", Value= 3957.99},
                new Data {Name= "Libya", Value= 6040.612},
                new Data {Name= "Sri Lanka", Value= 20758.779},
                new Data {Name= "Lesotho", Value= 2008.921},
                new Data {Name= "Lithuania", Value= 3068.457},
                new Data {Name= "Luxembourg", Value= 507.885},
                new Data {Name= "Latvia", Value= 2090.519},
                new Data {Name= "Morocco", Value= 31642.36},
                new Data {Name= "Moldova", Value= 103.619},
                new Data {Name= "Madagascar", Value= 21079.532},
                new Data {Name= "Mexico", Value= 117886.404},
                new Data {Name= "Macedonia", Value= 507.885},
                new Data {Name= "Mali", Value= 13985.961},
                new Data {Name= "Myanmar", Value= 51931.231},
                new Data {Name= "Montenegro", Value= 620.078},
                new Data {Name= "Mongolia", Value= 2712.738},
                new Data {Name= "Mozambique", Value= 23967.265},
                new Data {Name= "Mauritania", Value= 3609.42},
                new Data {Name= "Malawi", Value= 15013.694},
                new Data {Name= "Malaysia", Value= 28275.835},
                new Data {Name= "Namibia", Value= 2178.967},
                new Data {Name= "New Caledonia", Value= 246.379},
                new Data {Name= "Niger", Value= 15893.746},
                new Data {Name= "Nigeria", Value= 159707.78},
                new Data {Name= "Nicaragua", Value= 5822.209},
                new Data {Name= "Netherlands", Value= 16615.243},
                new Data {Name= "Norway", Value= 4891.251},
                new Data {Name= "Nepal", Value= 26846.016},
                new Data {Name= "New Zealand", Value= 4368.136},
                new Data {Name= "Oman", Value= 2802.768},
                new Data {Name= "Pakistan", Value= 173149.306},
                new Data {Name= "Panama", Value= 3678.128},
                new Data {Name= "Peru", Value= 29262.83},
                new Data {Name= "Philippines", Value= 93444.322},
                new Data {Name= "Papua New Guinea", Value= 6858.945},
                new Data {Name= "Poland", Value= 38198.754},
                new Data {Name= "Puerto Rico", Value= 3709.671},
                new Data {Name= "North Korea", Value= 1.468},
                new Data {Name= "Portugal", Value= 10589.792},
                new Data {Name= "Paraguay", Value= 6459.721},
                new Data {Name= "Qatar", Value= 1749.713},
                new Data {Name= "Romania", Value= 21861.476},
                new Data {Name= "Russia", Value= 21861.476},
                new Data {Name= "Rwanda", Value= 10836.732},
                new Data {Name= "Western Sahara", Value= 514.648},
                new Data {Name= "Saudi Arabia", Value= 27258.387},
                new Data {Name= "Sudan", Value= 35652.002},
                new Data {Name= "South Sudan", Value= 9940.929},
                new Data {Name= "Senegal", Value= 12950.564},
                new Data {Name= "Solomon Islands", Value= 526.447},
                new Data {Name= "Sierra Leone", Value= 5751.976},
                new Data {Name= "El Salvador", Value= 6218.195},
                new Data {Name= "Somaliland", Value= 9636.173},
                new Data {Name= "Somalia", Value= 9636.173},
                new Data {Name= "Republic of Serbia", Value= 3573.024},
                new Data {Name= "SuriName", Value= 524.96},
                new Data {Name= "Slovakia", Value= 5433.437},
                new Data {Name= "Slovenia", Value= 2054.232},
                new Data {Name= "Sweden", Value= 9382.297},
                new Data {Name= "Swaziland", Value= 1193.148},
                new Data {Name= "Syria", Value= 7830.534},
                new Data {Name= "Chad", Value= 11720.781},
                new Data {Name= "Togo", Value= 6306.014},
                new Data {Name= "Thailand", Value= 66402.316},
                new Data {Name= "Tajikistan", Value= 7627.326},
                new Data {Name= "Turkmenistan", Value= 5041.995},
                new Data {Name= "East Timor", Value= 10016.797},
                new Data {Name= "Trinidad and Tobago", Value= 1328.095},
                new Data {Name= "Tunisia", Value= 10631.83},
                new Data {Name= "Turkey", Value= 72137.546},
                new Data {Name= "United Republic of Tanzania", Value= 44973.33},
                new Data {Name= "Uganda", Value= 33987.213},
                new Data {Name= "Ukraine", Value= 46050.22},
                new Data {Name= "Uruguay", Value= 3371.982},
                new Data {Name= "United States of America", Value= 312247.116},
                new Data {Name= "Uzbekistan", Value= 27769.27},
                new Data {Name= "Venezuela", Value= 236.299},
                new Data {Name= "Vietnam", Value= 89047.397},
                new Data {Name= "Vanuatu", Value= 236.299},
                new Data {Name= "West Bank", Value= 13.565},
                new Data {Name= "Yemen", Value= 22763.008},
                new Data {Name= "South Africa", Value= 51452.352},
                new Data {Name= "Zambia", Value= 13216.985},
                new Data {Name= "Zimbabwe", Value= 13076.978}
            };

            ViewData["data1"] = data1;

            return View("");
        }
    }
}