Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MVC
Here is my code but it does not work... shows nothing Hmmm | :|
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 3:48am

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

  Print Answers RSS
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,192
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2014
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