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

Chart not showing data

2 Answers 149 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Joao
Top achievements
Rank 1
Joao asked on 07 Dec 2013, 08:43 PM
Hello everyone!

So I  have a mysql database. From here I get my json.php file. This will echo this:

{"cols":[{"label":"Weekly Task","type":"string"},{"label":"Percentage","type":"number"}],"rows":[{"c":[{"v":"SLEEP"},{"v":30}]},{"c":[{"v":"Watching Movie"},{"v":10}]},{"c":[{"v":"job"},{"v":40}]},{"c":[{"v":"Exercise"},{"v":20}]}]}

My main php code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    
    <link rel="stylesheet" href="http://cdn.kendostatic.com/2012.2.710/styles/kendo.dataviz.min.css">

</head>
<body>
    <header>
   
    </header>
    <!-- page content goes here -->
    <div role="main">
        <!-- chart/gauge -->
        <div id="chart">
        </div>
    </div>
    <footer>
    
    </footer>

    <script src="jquery.min.js"></script>
    <script src="http://cdn.kendostatic.com/2012.2.710/js/kendo.dataviz.min.js"></script>

    <script>
        
        jQuery(document).ready(function($) {
   $("#chart").kendoChart({
                theme: "metro",
                dataSource: {
                    transport: {
                        read: {
                            url: 'json.php',
                            dataType: 'json'
                        }
                    }
                },
                series: [{ name: "Name", type: "Age"}],

                categoryAxis: [{ field: "OptionTitles" }],
                line: { visible: true }

            });
        });
    </script>

</body>
</html>


But no data is loading on the chart! Any help will be much appreciated! 

Thank in advance!

2 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 10 Dec 2013, 03:32 PM
Hi Joao,

Kendo UI DataSource does not support nested data structures - in order to achieve the expected result you should use flat data.

Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
John
Top achievements
Rank 1
answered on 22 Jan 2014, 10:15 AM
may be it's useful  for you,it is working for me.
Tags
Charts
Asked by
Joao
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
John
Top achievements
Rank 1
Share this question
or