I have an asp.net application in which I am using multiple kendo charts. My requirement is to show the remote data using aspx web methods. But I am not getting any data in kendo charts.

Here is my code,

var dataSource = new kendo.data.DataSource({
type: "json",
  transport: {
    read: {
      type: "POST",
      url: "Commercial.aspx/FetchCounts",
      contentType: 'application/json; charset=utf-8',
      datatype: "json"
          }, //read
          parameterMap: function (options) {
          return $.parseJSON(options);
          } 
       }, 
       serverFiltering: false,
       serverSorting: false,
       schema: {
             data: "d",
               model: {
                 fields: {
                  current: { type: "string" },
                  target: { type: "string" }
                         }
                     }
                  }
              });
    function createSparklines() {
    $("#chart-CurrentWeekCount").kendoChart({
         legend: {
         visible: false
         },
         dataSource : dataSource,
         series: [{
            type: "bullet",
            currentField: "current",
            targetField: "target",
            target: {
                 color: "#e13c02"
                    },
            }],
            categoryAxis: {
                majorGridLines: {
                visible: false
            },
            majorTicks: {
                visible: false
                        }
                },
                 valueAxis: [{
                      plotBands: [{
                                from: 0, to: 8000, color: "#ccc", opacity: .3
                            }],
                  majorGridLines: {
                                visible: false
                  },
                  min: 0,
                  max: 8000,
                  majorUnit: 2000,
                  minorTicks: {
                       visible: true
                  }
                  }],
                  tooltip: {
                      visible: false,
                      template: "Goal: #= value.target # <br /> Current: #= value.current #"
                        }
                    });
            }
            $(document).ready(createSparklines);
           $(document).bind("kendo:skinChange", createSparklines);

The method "FetchCounts" returns the following data : [{"current":5000,"target":7500}]

Please let me know what I am missing. Any ideas will be appreciated.

Thanks.

Related posts

Recent Viewed