This is a migrated thread and some comments may be shown as answers.

assigning data to pie chart

1 Answer 80 Views
Charts
This is a migrated thread and some comments may be shown as answers.
pelin
Top achievements
Rank 1
pelin asked on 23 Jan 2013, 10:21 AM
  I wrote the code below, the data came to the web service but I couldn't see any chart on the page.The title can be seen on the page(Pie Chart Test), the createChart function is called but  datasource part does not work. If you can help, I would be glad.

Note: Json data is attached as data.json

       <script>
           
                function createChart() {
                    $("#chart").kendoChart({
                        theme: $(document).data("kendoSkin") || "default",
                        title: {
                            text: "Pie Chart Test"
                        },
                        legend: {
                            position: "bottom",
                                },
                        seriesDefaults: {
                            labels: {
                                visible: true,
                                format: "{0}%"
                            }
                        },
                     
                        categoryAxis: {
                            field: "ID"
                        },
                        dataSource: {
                            transport: {
                                read: {
                                    url: "Machine.asmx/GetDuration",
                                    dataType: "json"
                                }
                            },
                        },
                        series: [{
                            type: "pie",

                        }],
                       tooltip: {
                            visible: true,
                            format: "{0}%"
                        }
                    });
                }

                $(document).ready(function () {
                    setTimeout(function () {
                        // Initialize the chart with a delay to make sure
                        // the initial animation is visible
                        createChart();
                        $("#example").bind("kendo:skinChange", function (e) {
                            createChart();
                        });
                    }, 400);
                });
            </script>

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 24 Jan 2013, 12:01 PM
Hello Pelin,

I believe the issue is caused because you have not pointed the field and the categoryField for the series (like in this online demo). For your convenience I used the provided configuration and prepared a simple HTML page which demonstrates a correct implementation.

As a general information, please note that categoryAxis is not a valid option for Kendo UI Pie Chart (for the available options you could check the corresponding documentation).
 
Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
pelin
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or