I have created a D3 force directive graph with normal javascript.
Here is the working D3 graph
Now i need to get the data from a service and generate the graph in AngularJS. How can I make a directive out of this? Any example or guidance will be great.
I have made a controller to get the data from the service. And the code is here:
$scope.buildchart = function(widget) {
var w2 = new Worker("scripts/webworkers/bigQueryWorker.js");
w2.postMessage($scope.selectedClass + ","
+ $rootScope.hierarchystring.toString()
+ "," + "Hierarchy" + "," + Digin_Engine_API);
w2.addEventListener('message', function(event) {
hierarchyRetrieved(event);
});
function hierarchyRetrieved(event) {
var obj = JSON.parse(event.data);
console.log("Hierarchy data is");
console.log(JSON.stringify(obj));
};
};
Is there a way I could get this data inside this function?
function loadImage() {}