Wijmo UI for the Web
Binding to an Array
Wijmo User Guide > Widgets > Chart Widgets > PieChart > PieChart Concepts > Binding to an Array

You can bind the PieChart widget to an array using the dataSource option, and bind the label, data, and offset options in your seriesList using the data option.

Set the dataSource with code like the following:

Drop down and copy script to paste in <head> section

Script
Copy Code
<script id="script1" type="text/javascript">
var data = [{
                Device: 'MacBook Pro',
                Percent: 46.78,
                Offset: 15
            }, {
                Device: 'iMac',
                Percent: 23.18
            }, {
                Device: 'MacBook',
                Percent: 20.25
            }, {
                Device: 'Mac Pro',
                Percent: 5.41
            }, {
                Device: 'Mac mini',
                Percent: 3.44
            }];
    $(document).ready(function () {
            $("#wijpiechart").wijpiechart({
                dataSource: data,
                data: {
                    label: { bind: "Device" },
                    value: { bind: "Percent" },
                    offset: { bind: "Offset" }
                }
            });
    });
</script>

The pie chart appears like the following live widget.

See Also

KO

Data

Reference