Feeling a bit stuck here, I'm importing JSON data into a smart table and creating charts based on that table. I want to implement cross-filtering so that when a filter is applied, the chart updates based on the filtered data in the table.
The chart should display the status of orders, which could be: "Work in Progress," "Pending," "Approved," and so on. I've tried writing various functions to count the occurrences of each element, but none seem to be working:
My current code is as follows:
$scope.$watch(function() {
$scope.zdata = $scope.displayed;
$scope.labels = [];
$scope.data = [];
$scope.updatedata = function() {
//var a = getCount('Approved');
//$scope.zdata.forEach(function (zdata) {
$scope.labels.push('Approved', 'Awaiting Verification', 'Work In Progress');
$scope.data.push('20', '15', '3');
// $scope.labels.push(zdata.Status);
// $scope.data.push(zdata.Status.length);
// });
};
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
Currently, I am using placeholder data just for demonstration purposes. Thank you in advance!