Click here to Skip to main content
12,955,891 members (65,768 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Here is my code but it does not work... shows nothing :|
what have i done wrong?
how to call the datasource in the function?

 
<div id="example" class="k-content absConf">
            <div class="chart-wrapper" style="margin: auto;">
                <div id="chart"></div>
            </div>
            <script type="text/javascript">
 
                var transport = {
                    read: {
                        url: "..."
                    }
                };
 
                var data = new kendo.data.DataSource({
                    transport: transport,
                    sort: {
                        field: "day",
                        dir: "asc"
                    }
                });
                
               
             
 

 
 function createChart() {
 
     $("#chart").kendoChart({
         theme: $(document).data("kendoSkin") || "silver",
         dataSource: data,
             
         
 
         title: {
             text: "Value per day"
         },
         legend: {
             position: "top",
             font: "18px Verdana"
 
         },
         seriesDefaults: {
             type: "line"
         },
         series:
                        [{
                            field: "value",
                            name: "value"
                        }],
 
         valueAxis: {
             field: "value"
         },
         categoryAxis: {
             field: "day"
         },
 

         tooltip: {
             visible: true,
             format: "N0"
         }
     });
                 }
 
                 $(document).ready(function () {
                     setTimeout(function () {
 

                         createChart();
 
                         $("#example").bind("kendo:skinChange", function (e) {
                             createChart();
                             data.read();
                         });
                     }, 400);
                 });
                        
            </script>
        </div>
 

 


and the result from the webservice :

{ "day": "Monday", "value": 10 }, { "day": "Tuesday", "value": 18 }, { "day": "Wednesday", "value": 43 } ;
Posted 8-Feb-13 2:48am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,719
CHill60 3,550
Maciej Los 3,153
ppolymorphe 2,060
Jochen Arndt 1,975


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100