Search code examples
kendo-uitelerikkendo-mobilekendo-charttelerik-appbuilder

Difficulty implementing Chart widget with Kendo UI


I'm creating a mobile app using KendoUI in the Telerik AppBuilder. I created a blank view to hold my chart and then went in to start adding the code. I cannot get the chart to appear.

These are the scripts referenced in my index.html:

<script src="cordova.js"></script>
<script src="kendo/js/jquery.min.js"></script>
<script src="kendo/js/kendo.mobile.min.js"></script>
<script src="app.js"></script>
<script src="lib/progress/progress.all.min.js"></script>
<script src="dataProviders/progressDataProvider.js"></script>

Here is the code of my chart view:

<div data-role="view" data-title="Audit Tracker" data-layout="main" data-    model="app.auditTracker" data-show="app.auditTracker.onShow" data-after-show="app.auditTracker.afterShow">

    <div id="chart">
    </div>

</div>

And here is the code in the associated JavaScript file:

'use strict';

app.auditTracker = kendo.observable({
    onShow: function () {},
    afterShow: function () {}
});



(function(parent) {

        $("#chart").kendoChart({
            title: {
                text: "Audit Tracker"
            },
            series: [
                {name: "Audits Completed", data: [5,10,15,3]}
            ],
            categoryAxis: {
                categories: ["January", "February", "March", "April"]
            }
        });
})(app.auditTracker);

What am I doing wrong here? This seems like it should be simple! Thanks in advance for the help.


Solution

  • My problem was that I did not have the correct framework files referenced in my index.html. Here are the files that I ended up using as far as the framework goes:

    <script src="cordova.js"></script>
    <script src="jquery.min.js"></script>    
    <script src="kendo.all.min.js"></script>
    
    <link rel="stylesheet" href="kendo.common.min.css" />
    <link rel="stylesheet" href="kendo.default.min.css" />
    <link rel="stylesheet" href="kendo.mobile.all.min.css"/>