Question

I have created a pie chart using the HTML5 Chart JS object.

I have integrated this chart quite easily but I am struggling to find how to change the default values using the documentation.

Here is what I have done so far to remove animation from the graphic:

<html>
<head>
    <title>Radar Chart</title>
    <script src="../Chart.js"></script>
    <meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
    <style>
        canvas{
        }
    </style>
</head>
<body>
    <canvas id="canvas" height="450" width="450"></canvas>


<script>

    var pieData = [
            {
                value: 30,
                color:"#F38630"
            },
            {
                value : 50,
                color : "#E0E4CC"
            },
            {
                value : 100,
                color : "#69D2E7"
            }

        ];
    var options = {
    animation : false,};    

var myPie = new Chart(document.getElementById("canvas").getContext("2d")).Pie(pieData);


</script>
</body>

Adding this option doesn't seem to have any affect though.

Any ideas where I am going wrong?

Was it helpful?

Solution

You might want to get rid of your extra comma in the options object and then pass in options as a second parameter into the Pie method:

var options = {
  animation : false
};    

var myPie = new Chart(document.getElementById("canvas").getContext("2d")).Pie(pieData, options);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top