ChartJS.org Pie Chart

<canvas id=PieChartCanvas" style="width:100%;height:100px;"></canvas>
<script src="~/Assets/js/charts/chartjs.org/Chart.min.js"></script>

<script>

    //Declaring chart context.
    var PieChartContext = document.getElementById("PieChartCanvas").getContext("2d");
    //Chart data (an array of objects).
    var data = [
    {
        value: '@ViewBag.LikedQuantity',
        color: "#2D882D",
        highlight: "#116611",
        label: "Liked"
    },
    {
        value: '@ViewBag.NotLikedQuantity',
        color: "#AA3939",
        highlight: "#550000",
        label: "Not Liked"
    }
    ]

    //Finally draw the chart.
    var PieChart = new Chart(PieChartContext).Pie(data);

</script>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s