Chartjs-Creating charts (charts.js) values coming from SQLite database using AngularJS

0👍

I figured it out already. Let me know if I did it right. But the chart gets values from my database.

  $scope.status = ["Approved", "Pending"];
          $scope.stats = ["Stats"];

var query = "SELECT sum(members.status='P') as pending, "
      + "sum(members.status='A') as approved FROM members";
      $cordovaSQLite.execute(db, query, [])
      .then(function(res){
            $scope.memStatData= res.rows.item(0);
            var p = $scope.memStatData.pending;
            var a = $scope.memStatData.approved;
            console.log(p);
            console.log(a);
            $scope.memStatData = [
                [p, a]
            ];
      }, function(err){
          // $cordovaToast.showShortBottom('Something Went Wrong').then(function(success){}, function(err){});
          console.log(err.message);
      });

Leave a comment