I am using angular-charts directives in my application and it works well when we set the data initially.But when i read the data from json file and assign the data to the chart, it just generates x axis and y axis but not the legends.Here is my code,
HTML:
<div id="content" ng-controller="MainCtrl1" class="box-content">
<div style="position:relative">
<div data-ac-chart="'bar'" data-ac-data="widget.data" data-ac-config="config" class="chart">
</div>
</div>
Here is the model where i read the data from a file,
<div class="col-lg-6 col-md-6">
<div class="form-group">
<div >
<input type="file" on-read-file="showContent($fileContent)" />
</div>
</div>
App.JS:
$scope.data = {
"series": ["Northern", "Western", "Southern", "East", "Center"],
"data": [ {
"x": "Mahinda",
"y": [90, 800, 600,100,900]
}, {
"x": "Maithiri",
"y": [351,439,380,800,300]
}, {
"x": "Others",
"y": [140, 33,230, 879,43]
}]
};
Here am assigning the data to the widget,
$scope.addBarChart = function() {
$scope.dashboard.widgets.push({
name: "General election",
sizeX: 110,
sizeY: 50,
type:"Bar",
data:$scope.data
});
};
This works well, and this is the output.

Then am reading the data from a json file and assigning to the data object of widget,
$scope.showContent = function($fileContent){
$scope.widget.data = $fileContent;
};
Here is the output:

There is no errors on the console as well.