Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Thats My Controller-
XML
public ActionResult DashBoard()
      {
          var user = repository.Get<ApplicationUser>(m => m.UserName == User.Identity.Name);

          ViewBag.List = repository.GetMany<TestResult>(m => m.TestInfoID == 3 && m.Username == User.Identity.Name).Select(n => new { TestDate = n.TestDate.ToString("yyyy-MM-dd"), BMI = Converter.CalculateBMI(user.Weight, true, user.Height, true).ToString("#.##"), BodyFat = Convert.ToDouble(n.Result).ToString("#.##"), FatWeight = Converter.CalculateFatWeight(user.Weight, Convert.ToDouble(n.Result)).ToString("#.##"), MuscleWeight = Converter.CalculateMuscleMass(user.Weight, Convert.ToDouble(n.Result)).ToString("#.##") });

return View();
}



ITs MY VIew=

C#
<script>
      $(function () {
          var jsondata= @Html.Raw(Json.Encode(ViewBag.list))
    $('#container').highcharts({

        chart: {
            type: 'gauge',
            alignticks: false,
            plotbackgroundcolor: null,
            plotbackgroundimage: null,
            plotborderwidth: 0,
            plotshadow: false
        },

        title: {
            text: 'speedometer with dual axes'
        },

        pane: {
            startangle: -150,
            endangle: 150
        },

        yaxis: [{
            min: 0,
            max: 200,
            linecolor: '#339',
            tickcolor: '#339',
            minortickcolor: '#339',
            offset: -25,
            linewidth: 2,
            labels: {
                distance: -20,
                rotation: 'auto'
            },
            ticklength: 5,
            minorticklength: 5,
            endontick: false
        }],

        series: [{
            name: 'speed',
            data: __________________, 
            datalabels: {
                formatter: function () {
                    var kmh = this.y;

                    return '<span style="color:#339">'+ kmh + ' kg</span><br/>' ;
                },
                backgroundcolor: {
                    lineargradient: {
                        x1: 0,
                        y1: 0,
                        x2: 0,
                        y2: 1
                    },
                    stops: [
                        [0, '#ddd'],
                        [1, '#fff']
                    ]
                }
            },
            tooltip: {
                valuesuffix: ' km/h'
            }
        }]

    },
    // add some life
    function(chart) {
        setinterval(function () {
            var point = chart.series[0].points[0],
                newval, inc = math.round((math.random() - 0.5) * 20);

            newval = point.y + inc;
            if (newval < 0 || newval > 200) {
                newval = point.y - inc;
            }

            point.update(newval);

        }, 3000);

    });
});
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900