I tried to turn this database
to be radar chart using angular-chart.
I'm wondering how to turn my Firebase array to be a new array compatible with this angular-chart array format?
$scope.labels =["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running", "Running", "Running", "Running"];
$scope.data = [[12,14,23,56,64,34,46,34,76,12]];
I tried this but it failed
$scope.labels =$scope.results.$id;
$scope.data = [$scope.results.$value];
Edited: this is my own answer base on digit's knowledge
$scope.labels = [], $scope.dataRaw = [], $scope.data = [];
fireBaseData.refUser().child($scope.user_info.uid).child("result")
.orderByValue()
.on("value", function(snapshot){
snapshot.forEach(function(data){
console.log("The "+ data.key()+" score is "+ data.val());
$scope.labels.push(data.key());
$scope.dataRaw.push(data.val());
});
});
$scope.data.push($scope.dataRaw);
You can actually by doing this