0
votes

I am having problems with the datasource for a kendo chart.

Controller code:

$scope.data = new kendo.data.DataSource({
            transport: {
                read: _read
            },
            sort: ({ field: 'date', dir: "asc" })
        })

        function _read(e) {
            $http.get(('checkinstats/'), {
            }).then(response => {
                e.success({
                    data: response.data
                });
                }).catch(response => {
                    e.error();
                });
        }

$scope.chartSeries = [{ field: 'count', name: '#= group.items[0].name #' }];

Chart code:

<div kendo-chart
     k-series-defaults="{ type: 'line' }"
     k-series="{{chartSeries}}"
     k-data-source="{{data}}"</div>

This is the error message in the consol i get: TypeError: Cannot read property 'data' of undefined

1

1 Answers

0
votes

That basically means that your "response" is undefined and that your checkinstats/ service is not returning anything. Did you make sure that it returns something back?