AngularJS amcharts

I need to implement amchart using angular JS with a very tight deadline. I am new to both, especially angular, so I am currently having issue with generating chart with dynamic JSON data.

The chart works if I use hard coded Json, but it doesn't work if i read and pass Json data.

Please let me know if you need me code. Please alsoangularJS_amcharts.txt post a working sample code for the same, appreciate your help!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

generateCharData() returns an empty array immediately it is called. Much later the http call returns and updates an unwatched local.

The http call needs to update a watched variable, is $scope.something in the success() function.
Srinivasulu MuppalaLead DeveloperCommented:
Hi samssAabee,

Do simple changes in your code to fix it.

  .controller('chartController',['$scope', '$http','$location', '$routeParams', 'repService', function ($scope, $http) {
	  $scope.amChartOptions = {
	           	//data: '[{' + chartData + '}]', 	
			  	//data: $, 
	            type: "serial",
	            theme: 'black',
	            categoryField: "year",
	            rotate: true,
	           // pathToImages: '',
	            legend: {
	                enabled: true
	            chartScrollbar: {
	                enabled: true,
	            categoryAxis: {
	                gridPosition: "start",
	                parseDates: false
	            valueAxes: [{
	                position: "top",
	                title: "Range"
	            graphs: [{
	                type: "column",
	                title: "Value",
	                valueField: "value",
	                fillAlphas: 1,
	// generates some random data
	   function generateChartData() {
	       var chartData = [];
	       var firstDate = new Date();
	       firstDate.setDate(firstDate.getDate() - 5);

		 	.success(function(data) {
		 		for(i in data){
		 			year  : data[i].year, 
					income: data[i].income
                   $ = chartData;


<div class="flot-chart" id="demo-toggle-series-chart" >
   	<am-chart id="myFirstChart" options="amChartOptions"></am-chart>

Open in new window

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.