{"action":"closed","issue":{"url":"https://api.github.com/repos/nnnick/Chart.js/issues/978","labels_url":"https://api.github.com/repos/nnnick/Chart.js/issues/978/labels{/name}","comments_url":"https://api.github.com/repos/nnnick/Chart.js/issues/978/comments","events_url":"https://api.github.com/repos/nnnick/Chart.js/issues/978/events","html_url":"https://github.com/nnnick/Chart.js/issues/978","id":60272383,"number":978,"title":"Bar chart not displayed in ASP.NET MVC using AJAX call","user":{"login":"etairi","id":1489395,"avatar_url":"https://avatars.githubusercontent.com/u/1489395?v=3","gravatar_id":"","url":"https://api.github.com/users/etairi","html_url":"https://github.com/etairi","followers_url":"https://api.github.com/users/etairi/followers","following_url":"https://api.github.com/users/etairi/following{/other_user}","gists_url":"https://api.github.com/users/etairi/gists{/gist_id}","starred_url":"https://api.github.com/users/etairi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etairi/subscriptions","organizations_url":"https://api.github.com/users/etairi/orgs","repos_url":"https://api.github.com/users/etairi/repos","events_url":"https://api.github.com/users/etairi/events{/privacy}","received_events_url":"https://api.github.com/users/etairi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nnnick/Chart.js/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-08T19:40:18Z","updated_at":"2015-03-17T14:36:34Z","closed_at":"2015-03-17T14:36:34Z","body":"I have the following code segment:\r\n\r\n```javascript\r\n(function () {\r\n    var randomScalingFactor = function () { return Math.round(Math.random() * 100) };\r\n\r\n    var barData = {\r\n        labels: [],\r\n        datasets: [\r\n            {\r\n                label: \"Test\",\r\n                fillColor: \"rgba(151,187,205,0.5)\",\r\n                strokeColor: \"rgba(151,187,205,0.8)\",\r\n                highlightFill: \"rgba(151,187,205,0.75)\",\r\n                highlightStroke: \"rgba(151,187,205,1)\",\r\n                data: []\r\n            }\r\n        ]\r\n    };\r\n\r\n    $.ajax({\r\n        url: \"/GetTeams\",\r\n        dataType: \"json\",\r\n        success: function (data) {\r\n            console.log(\"Length is: \" + data.length);\r\n            for (i = 0; i < data.length; i++) {\r\n                barData.labels.push(data[i].FullName);\r\n                barData.datasets[0].data.push(randomScalingFactor());\r\n            }\r\n            console.log(barData.labels);\r\n            console.log(barData.datasets[0].data);\r\n        }\r\n    });\r\n\r\n    var ctx = document.getElementById(\"canvas\").getContext(\"2d\");\r\n    window.myBar = new Chart(ctx).Bar(barData, {\r\n        responsive: true\r\n    });\r\n\r\n}());\r\n```\r\n\r\nWhen I check the console, for the arrays, I get the following values:\r\n\r\n\"Length is: 10\" \r\nArray [ \"Team #1\", \"Team #2\", \"Team #3\", \"Team #4\", \"Team #5\", \"Team #6\", \"Team #7\", \"Team #8\", \"Team #9\", \"Team #10\" ]\r\nArray [ 74, 53, 38, 37, 92, 47, 40, 5, 22, 16 ]\r\n\r\nThis seems all fine to me. But, the graph is not displayed. It shows just this: http://prntscr.com/6edcyt. But if I enter manually the labels and the values, it works all fine. But, when I use an AJAX call it is not working. Any idea how to solve it?"}}