I have a problem with showing data from json in c3.
I send data from express and I can get it in ./behavior
Here is my angular controller:
angular.module('app')
.controller('GraphCtrl', function ($scope) {
d3.json('./behavior', function(err, data){
if(err){ throw err; }
$scope.data = data;
console.log(data);
$scope.$apply();
$scope.chart = c3.generate({
bindto: '#behavior',
data: {
columns: [],
type: 'bar',
},
bar: {
width: {
ratio: 0.4 // this makes bar width 50% of length between ticks
}
},
grid: {
x: {
show: true
},
y: {
show: true
}
},
color: {
pattern: ['#FF9800', '#8BC34A', '#E040FB', '#3F51B5', '#FF4081']
}
});
});
and I bind it to HTML:
<div id="graph" ng-controller="BehaviorGraphCtrl">
<div id="behavior"></div>
</div>
What I'm doing wrong?