# A Pie chart with gradients

This Pie chart shows you how you can use gradients, shadows and segment separation in-conjunction with each other to good effect.

This goes in the documents header:

    <script src="RGraph.common.core.js"></script>
    <script src="RGraph.pie.js"></script>

Put this where you want the chart to show up:

    <canvas id="cvs" width="800" height="600">
        [No canvas support]
    </canvas>

This is the code that generates the chart:

    <script>
        window.onload = function ()
        {
            var pie = new RGraph.Pie({
                id: 'cvs',
                data: [17,15,16,15,13,13,15,15,11,15,12,15,15],
                options: {
                    radius: 175,
                    linewidth: 3,
                    textSize: 18,
                    strokestyle: 'white',
                    shadow: false,
                    shadowColor: '#ddd',
                    labels: ['Alvin','Pete','Hoolio','Jack','Kevin','Luis','Louise','Jesse','Rachel','Christian','Lola','Kevin','Barry','Peter','Luis'],
                    labelsSticksList: true,
                    exploded: 5,
                    colors: [
                        'Gradient(white:#ff0:#aa0:#660)', 'Gradient(white:#f00:#a00:#600)',
                        'Gradient(white:#0ff:#0aa:#066)', 'Gradient(white:#0f0:#0a0:#060)',
                        'Gradient(white:#fff:#aaa:#666)', 'Gradient(white:#f0f:#a0a:#606)',
                        'Gradient(white:#ff0:#aa0:#660)','Gradient(white:#f00:#a00:#600)',
                        'Gradient(white:#0ff:#0aa:#066)','Gradient(white:#0f0:#0a0:#060)',
                        'Gradient(white:#fff:#aaa:#666)', 'Gradient(white:#f0f:#a0a:#606)',
                        'Gradient(white:#fff:#aaa:#666)'
                    ],
                    textAccessible: true
                }
            }).draw();
        };
    </script>

« Back