Kendo mobile line chart binding not working

2 posts, 0 answers
  1. Nirav
    Nirav avatar
    16 posts
    Member since:
    Jul 2014

    Posted 29 Aug 2014 Link to this post

    Hello,

    I want to create a line chart and bind the data using JSON file. This is my code but it is not working. 

     $("#line-chart1").kendoChart({
                    theme: $(document).data("kendoSkin") || "BlueOpal",
                    legend: {
                        visible: false
                    },
                    dataSource: {
                        transport: {
                            read: {
                                url: "Myjsonfile",
                                dataType: "json"
                            }
                        }
                    },
                    seriesDefaults: {
                        type: "Line"
                    },
                    series: [{
                        currentField: "current",
                        targetField: "target"
                    }],
                    valueAxis: {
                        majorUnit: 8000
                    },
                    tooltip: {
                        visible: true,
                        shared: true,
                        format: "N0"
                    }
                });

    This is my json file 

    [{
        "current": 800,
        "target": 200
    }]



    Thanks.
  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2622 posts

    Posted 01 Sep 2014 Link to this post

    Hello Nirav,

    For categorical charts (such as line, column etc.) you should define series.field (not currentField / targetField). For example: 
    //....
    series: [{
       type: "line",
       field: "current"
    }],
    For working example check the online demos.

    Regards,
    Iliana Nikolova
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top