MVC4 Classic
wijpiechart Step 2 of 3: Initializing the Widget

In the previous step, you added markup to add the content that will appear in the scatter chart. Now you can add the jQuery script to initialize the widget as well as set the text of the X and Y axes, add a tooltip to the chart labels, add a chart header called, “Hardware Distribution”, and use the seriesList to create three data series with string data for the X-Axis and numerical data for the Y-Axis.

After the closing </div> tags you added in the previous step, enter the following jQuery script to initialize the wijpiechart widget:

<style type="text/css">
        #wijpiechart
        {
            width: 756px;
            height: 475px;
        }
    </style>
    <script id="scriptInit" type="text/javascript">
        $(document).ready(function () {
            $("#wijpiechart").wijpiechart({
                radius: 140,
                legend: { visible: true },
                hint: {
                    content: function () {
                        return this.data.label + " : " + Globalize.format(this.value / this.total, "p2");
                    }
                },
                header: {
                    text: "Steam - Mac Hardware"
                },
                seriesList: [{
                    label: "MacBook Pro",
                    legendEntry: true,
                    data: 46.78,
                    offset: 15
                }, {
                    label: "iMac",
                    legendEntry: true,
                    data: 23.18,
                    offset: 0
                }, {
                    label: "MacBook",
                    legendEntry: true,
                    data: 20.25,
                    offset: 0
                }, {
                    label: "Mac Pro",
                    legendEntry: true,
                    data: 5.41,
                    offset: 0
                }, {
                    label: "Mac mini",
                    legendEntry: true,
                    data: 3.44,
                    offset: 0
                }],
                seriesStyles: [{
                    fill: "180-rgb(195,255,0)-rgb(175,229,0)", stroke: "rgb(175,229,0)", "stroke-width": "1.5"
                }, {
                    fill: "90-rgb(142,222,67)-rgb(127,199,60)", stroke: "rgb(127,199,60)", "stroke-width": "1.5"
                }, {
                    fill: "90-rgb(106,171,167)-rgb(95,153,150)", stroke: "rgb(95,153,150)", "stroke-width": "1.5"
                }, {
                    fill: "90-rgb(70,106,133)-rgb(62,95,119)", stroke: "rgb(62,95,119)", "stroke-width": "1.5"
                }, {
                    fill: "90-rgb(166,166,166)-rgb(149,149,149)", stroke: "rgb(149,149,149)", "stroke-width": "1.5"
                }]
            });
        });
    </script>
See Also

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback