@using Trirand.Web.Core
@using Trirand.Web.Core.Chart;
@using Trirand.Web.Core.Chart.ChartAxis;
@using Trirand.Web.Core.Chart.Series;
@using Trirand.Web.Core.Chart.Style;
@using Newtonsoft.Json.Linq;
@using System.Collections.Generic

<!DOCTYPE html>
<html lang="en-us">
<head>
    <meta charset="utf-8">
    <title>Chart for ASP.NET Core - Scatter Github Punchcard</title>
    <script type="text/javascript" src="~/js/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()
                    {
                        Text = "Punch Card of Github"
                    }
                },
                Legend = new Legend()
                {
                    Left = "right",
                    Data = new List<string>() { "Punch Card" }
                },
                Polar = new Polar(),
                Tooltip = new ToolTip()
                {
                    Formatter = new JRaw(@"function (params) {
                            return params.value[2] + ' commits in ' + hours[params.value[1]] + ' of ' + days[params.value[0]];
                        }")
                },
                AngleAxis = new AngleAxis
                {
                    Type = AxisType.Category,
                    Data = new List<string> {
                        "12a", "1a", "2a", "3a", "4a", "5a", "6a",
                        "7a", "8a", "9a", "10a", "11a",
                        "12p", "1p", "2p", "3p", "4p", "5p",
                        "6p", "7p", "8p", "9p", "10p", "11p"
                    },
                    BoundaryGap = false,
                    SplitLine = new SplitLine
                    {
                        Show = true,
                        LineStyle = new LineStyle { Color = "#999", Type = LineStyleType.Dashed }
                    },
                    AxisLine = new AxisLine {  Show = false }
                },
                RadiusAxis = new RadiusAxis
                {
                    Type = AxisType.Category,
                    Data = new List<string> { "Monday ", " Tuesday ", " Wednesday ", " Thursday ", " Friday ", " Saturday ", " Sunday" },
                    AxisLine = new AxisLine {  Show = false},
                    AxisLabel = new AxisLabel {  Rotate = 45 }
                },
                Series = new List<Series>()
                {
                    new Scatter
                    {
                        Name = "Punch Card",
                        CoordinateSystem = "polar",
                        SymbolSize = new JRaw(@" function (val) {
                                                    return val[2] * 2;
                                                }"),
                        AnimationDelay = new JRaw(@"function (idx) {
                                                    return idx * 5;
                                                }"),
                        Data = ViewData["data1"] as List<List<int>>
                    }
                }
            }
            , "Chart")
        )

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

using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
namespace CoreDemo.Controllers.Chart
{
    public partial class ChartController : Controller
    {
        [Route("chart/scatter/githubpunchcard")]
        public ActionResult GithubPunchCard()
        {
            List<List<int>> data1 = new List<List<int>>
            {
                new List<int> { 0, 0, 5 },
                new List<int> { 0, 1, 1 },
                new List<int> { 0, 2, 0 },
                new List<int> { 0, 3, 0 },
                new List<int> { 0, 4, 0 },
                new List<int> { 0, 5, 0 },
                new List<int> { 0, 6, 0 },
                new List<int> { 0, 7, 0 },
                new List<int> { 0, 8, 0 },
                new List<int> { 0, 9, 0 },
                new List<int> { 0, 10, 0 },
                new List<int> { 0, 11, 2 },
                new List<int> { 0, 12, 4 },
                new List<int> { 0, 13, 1 },
                new List<int> { 0, 14, 1 },
                new List<int> { 0, 15, 3 },
                new List<int> { 0, 16, 4 },
                new List<int> { 0, 17, 6 },
                new List<int> { 0, 18, 4 },
                new List<int> { 0, 19, 4 },
                new List<int> { 0, 20, 3 },
                new List<int> { 0, 21, 3 },
                new List<int> { 0, 22, 2 },
                new List<int> { 0, 23, 5 },
                new List<int> { 1, 0, 7 },
                new List<int> { 1, 1, 0 },
                new List<int> { 1, 2, 0 },
                new List<int> { 1, 3, 0 },
                new List<int> { 1, 4, 0 },
                new List<int> { 1, 5, 0 },
                new List<int> { 1, 6, 0 },
                new List<int> { 1, 7, 0 },
                new List<int> { 1, 8, 0 },
                new List<int> { 1, 9, 0 },
                new List<int> { 1, 10, 5 },
                new List<int> { 1, 11, 2 },
                new List<int> { 1, 12, 2 },
                new List<int> { 1, 13, 6 },
                new List<int> { 1, 14, 9 },
                new List<int> { 1, 15, 11 },
                new List<int> { 1, 16, 6 },
                new List<int> { 1, 17, 7 },
                new List<int> { 1, 18, 8 },
                new List<int> { 1, 19, 12 },
                new List<int> { 1, 20, 5 },
                new List<int> { 1, 21, 5 },
                new List<int> { 1, 22, 7 },
                new List<int> { 1, 23, 2 },
                new List<int> { 2, 0, 1 },
                new List<int> { 2, 1, 1 },
                new List<int> { 2, 2, 0 },
                new List<int> { 2, 3, 0 },
                new List<int> { 2, 4, 0 },
                new List<int> { 2, 5, 0 },
                new List<int> { 2, 6, 0 },
                new List<int> { 2, 7, 0 },
                new List<int> { 2, 8, 0 },
                new List<int> { 2, 9, 0 },
                new List<int> { 2, 10, 3 },
                new List<int> { 2, 11, 2 },
                new List<int> { 2, 12, 1 },
                new List<int> { 2, 13, 9 },
                new List<int> { 2, 14, 8 },
                new List<int> { 2, 15, 10 },
                new List<int> { 2, 16, 6 },
                new List<int> { 2, 17, 5 },
                new List<int> { 2, 18, 5 },
                new List<int> { 2, 19, 5 },
                new List<int> { 2, 20, 7 },
                new List<int> { 2, 21, 4 },
                new List<int> { 2, 22, 2 },
                new List<int> { 2, 23, 4 },
                new List<int> { 3, 0, 7 },
                new List<int> { 3, 1, 3 },
                new List<int> { 3, 2, 0 },
                new List<int> { 3, 3, 0 },
                new List<int> { 3, 4, 0 },
                new List<int> { 3, 5, 0 },
                new List<int> { 3, 6, 0 },
                new List<int> { 3, 7, 0 },
                new List<int> { 3, 8, 1 },
                new List<int> { 3, 9, 0 },
                new List<int> { 3, 10, 5 },
                new List<int> { 3, 11, 4 },
                new List<int> { 3, 12, 7 },
                new List<int> { 3, 13, 14 },
                new List<int> { 3, 14, 13 },
                new List<int> { 3, 15, 12 },
                new List<int> { 3, 16, 9 },
                new List<int> { 3, 17, 5 },
                new List<int> { 3, 18, 5 },
                new List<int> { 3, 19, 10 },
                new List<int> { 3, 20, 6 },
                new List<int> { 3, 21, 4 },
                new List<int> { 3, 22, 4 },
                new List<int> { 3, 23, 1 },
                new List<int> { 4, 0, 1 },
                new List<int> { 4, 1, 3 },
                new List<int> { 4, 2, 0 },
                new List<int> { 4, 3, 0 },
                new List<int> { 4, 4, 0 },
                new List<int> { 4, 5, 1 },
                new List<int> { 4, 6, 0 },
                new List<int> { 4, 7, 0 },
                new List<int> { 4, 8, 0 },
                new List<int> { 4, 9, 2 },
                new List<int> { 4, 10, 4 },
                new List<int> { 4, 11, 4 },
                new List<int> { 4, 12, 2 },
                new List<int> { 4, 13, 4 },
                new List<int> { 4, 14, 4 },
                new List<int> { 4, 15, 14 },
                new List<int> { 4, 16, 12 },
                new List<int> { 4, 17, 1 },
                new List<int> { 4, 18, 8 },
                new List<int> { 4, 19, 5 },
                new List<int> { 4, 20, 3 },
                new List<int> { 4, 21, 7 },
                new List<int> { 4, 22, 3 },
                new List<int> { 4, 23, 0 },
                new List<int> { 5, 0, 2 },
                new List<int> { 5, 1, 1 },
                new List<int> { 5, 2, 0 },
                new List<int> { 5, 3, 3 },
                new List<int> { 5, 4, 0 },
                new List<int> { 5, 5, 0 },
                new List<int> { 5, 6, 0 },
                new List<int> { 5, 7, 0 },
                new List<int> { 5, 8, 2 },
                new List<int> { 5, 9, 0 },
                new List<int> { 5, 10, 4 },
                new List<int> { 5, 11, 1 },
                new List<int> { 5, 12, 5 },
                new List<int> { 5, 13, 10 },
                new List<int> { 5, 14, 5 },
                new List<int> { 5, 15, 7 },
                new List<int> { 5, 16, 11 },
                new List<int> { 5, 17, 6 },
                new List<int> { 5, 18, 0 },
                new List<int> { 5, 19, 5 },
                new List<int> { 5, 20, 3 },
                new List<int> { 5, 21, 4 },
                new List<int> { 5, 22, 2 },
                new List<int> { 5, 23, 0 },
                new List<int> { 6, 0, 1 },
                new List<int> { 6, 1, 0 },
                new List<int> { 6, 2, 0 },
                new List<int> { 6, 3, 0 },
                new List<int> { 6, 4, 0 },
                new List<int> { 6, 5, 0 },
                new List<int> { 6, 6, 0 },
                new List<int> { 6, 7, 0 },
                new List<int> { 6, 8, 0 },
                new List<int> { 6, 9, 0 },
                new List<int> { 6, 10, 1 },
                new List<int> { 6, 11, 0 },
                new List<int> { 6, 12, 2 },
                new List<int> { 6, 13, 1 },
                new List<int> { 6, 14, 3 },
                new List<int> { 6, 15, 4 },
                new List<int> { 6, 16, 0 },
                new List<int> { 6, 17, 0 },
                new List<int> { 6, 18, 0 },
                new List<int> { 6, 19, 0 },
                new List<int> { 6, 20, 1 },
                new List<int> { 6, 21, 2 },
                new List<int> { 6, 22, 2 },
                new List<int> { 6, 23, 6 }
            };

            ViewData["data1"] = data1;

            return View("~/Views/Chart/Scatter/GithubPunchcard.cshtml");
        }
    }
}