@using Trirand.Web.Core
@using Trirand.Web.Core.Chart;
@using Newtonsoft.Json.Linq;

<!DOCTYPE html>
<html lang="en-us">
<head>
    <meta charset="utf-8">
    <title>Chart for ASP.NET Core - Radar AQI</title>
    <script type="text/javascript" src="~/js/trirand/chart/corechart.min.js"></script>
    <script type="text/javascript">

         function generateSeries() {
             var series = [];
             for (var i = 1; i <= 28; i++) {
                 series.push({
                     name: 'The Browser (fictional data)',
                     type: 'radar',
                     symbol: 'none',
                     itemStyle: {
                         normal: {
                             lineStyle: {
                                 width: 1
                             }
                         },
                         emphasis: {
                             areaStyle: { color: 'rgba(0,250,0,0.3)' }
                         }
                     },
                     data: [
                         {
                             value: [
                                 (40 - i) * 10,
                                 (38 - i) * 4 + 60,
                                 i * 5 + 10,
                                 i * 9,
                                 i * i / 2
                             ],
                             name: i + 2000 + ''
                         }
                     ]
                 })
             }

             return series;
         }

    </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() {
                                    Text = "Browser Market Share",
                                    Subtext = "Fictional Data",
                                    Top = 10,
                                    Left = 10
                                }
                         },
                         Tooltip = new ToolTip
                         {
                             Trigger = TriggerType.Item,
                             BackgroundColor = "rgba(0,0,250,0.2)"

                         },
                         Legend = new Legend
                         {
                             Bottom = 10,
                             Type = "scroll",
                             Data = ViewData["legendData"] as List<string>
                         },
                         VisualMap = new VisualMap
                         {
                             Top = "middle",
                             Right = 10,
                             Color = new List<string>() {  "red", "yellow" },
                             Calculable = true
                         },
                         Radar = new List<Radar>
                         {
                             new Radar
                             {
                                 Indicator = new List<IndicatorData>
                                 {
                                     new IndicatorData { Text = "IE8-", Max = 400 },
                                     new IndicatorData { Name = "IE9+", Max = 400 },
                                     new IndicatorData { Name = "Safari", Max = 400 },
                                     new IndicatorData { Name = "FireFox", Max = 400 },
                                     new IndicatorData { Name = "Chrome", Max = 400 }
                                 }
                             }
                         },
                         Series = new JRaw(@"generateSeries()")
                     }
            , "Chart")
        )

        <br />
        <div>
            @await Component.InvokeAsync("CodeTabs", new { product = "chart", example = "radar/radar2" })
        </div>
    </div>
</body>
</html>

using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;

namespace CoreDemo.Controllers.Chart
{
    public partial class ChartController : Controller
    {
        [Route("chart/radar/radar2")]
        public ActionResult Radar2()
        {
            List<string> legendData = new List<string>();
            for (int i = 1; i <= 28; i++)
            {
                legendData.Add((2000 + i).ToString());
            }

            ViewData["legendData"] = legendData;

            return View("~/Views/Chart/Radar/Radar2.cshtml");
        }
    }
}