Moje HTML:obciążenia JSON do wyświetlania danych, używając NG-repeat {angularjs}
<div class="graph-display" ng-controller="jsonServerBox">
<div class="bar-chart-box" ng-repeat="module in ocw.modules">
<canvas class="chart chart-bar" data="{{module.data}}" labels="{{module.labels}}" series="{{module.series}}"></canvas>
</div>
</div>
Kim JS:
app.controller('jsonServerBox', function($scope, $http) {
var json = $http.get('serverbox.json').then(function(res){
return res.data;
});
$scope.ocw = json;
});
Wykres nie zostanie wyświetlona, nie wiem czemu? Nie dostaję żadnego błędu w konsoli.
UPDATE: MY JSON pliki zawartości
[{"modules":[
{
"series":"SeriesA",
"data":["90", "99", "80", "91", "76", "75", "60", "67", "59", "55"],
"labels":["01", "02", "03", "04", "05", "06", "07","08","09","10"]
},
{
"series":"SeriesB",
"data":["90", "99", "80", "91", "76", "75", "60", "67", "59", "55"],
"labels":["01", "02", "03", "04", "05", "06", "07","08","09","10"]
}
]}
]
KONSOLA LOG:
modules: Array[2]0: Objectdata: Array[10]0: "90"1: "99"2: "80"3: "91"4: "76"5: "75"6: "60"7: "67"8: "59"9: "55"length: 10__proto__: Array[0]labels: Array[10]0: "01"1: "02"2: "03"3: "04"4: "05"5: "06"6: "07"7: "08"8: "09"9: "10"length: 10__proto__: Array[0]series: "SeriesA"__proto__: Object1: Objectdata: Array[10]0: "90"1: "99"2: "80"3: "91"4: "76"5: "75"6: "60"7: "67"8: "59"9: "55"length: 10__proto__: Array[0]labels: Array[10]0: "01"1: "02"2: "03"3: "04"4: "05"5: "06"6: "07"7: "08"8: "09"9: "10"length: 10__proto__: Array[0]series: "SeriesB"
możesz przynieść to w skrzypcach? –
Nie wyświetla się, ponieważ dane są wyświetlane po renderowaniu wykresu. Potrzebujesz danych do aktualizacji wykresu po załadowaniu danych. Zakładam, że wykres jest jakimś rodzajem biblioteki, więc normalny skrót kątowy nie zaktualizuje zmiennych, które podajesz do wykresu. – ribsies