angular.module('dvizer').service('electionService', ['$http', '$log', function ($http, $log) {

    var self = this;

    this.intimacyData = {};
    this.intimacyImageUrls = [];

    this.fetchIntimacyData = function () {
        return $http.get('lab/election/data/data3_forceAtlas2Layout.json').then(function (json) {
            self.intimacyImageUrls = _extractImageUrl(json.data);
            self.intimacyData = json.data;
        });
    };

    function _extractImageUrl(data) {
        var urls = [],
            prefix,
            noRepeat = {},
            nodes = data.nodes,
            edges = data.edges;
        
        prefix = 'lab/election/avatar/';
        nodes.forEach(function (item) {
            // process image
            if (item.attributes.Image) {
                if (angular.isString(item.attributes.Image)) item.attributes.Image = item.attributes.Image.trim();
                item.type = 'image';
                item.url = prefix + item.attributes.Image;
                if (!noRepeat[item.attributes.Image]) {
                    noRepeat[item.attributes.Image] = true;
                    urls.push(prefix + item.attributes.Image);
                }
            } else {
                item.type = 'def';
                item.url = null;
            }
        });
        var noRepeat={};
        edges.forEach(function (item) {
            item.color = '#908BF7';//908BF7,0027cc,0b0085,FE6A37
            item.hidden = false;
            noRepeat[item.source]=true;
            noRepeat[item.target]=true;
        });
        nodes.forEach(function (item) {
            if(noRepeat[item.label]) item.hidden=false; else item.hidden=true;
            item.color = '#908BF7';//#fff,0027cc,0b0085,0070c2
        });

        return urls;
    }
}]);

angular.module('dvizer').service('electionService', ['$http', '$log', function ($http, $log) {

    var self = this;

    this.intimacyData = {};
    this.intimacyImageUrls = [];

    this.fetchIntimacyData = function () {
        return $http.get('lab/election/data/data3_forceAtlas2Layout.json').then(function (json) {
            self.intimacyImageUrls = _extractImageUrl(json.data);
            self.intimacyData = json.data;
        });
    };

    function _extractImageUrl(data) {
        var urls = [],
            prefix,
            noRepeat = {},
            nodes = data.nodes,
            edges = data.edges;
        
        prefix = 'lab/election/avatar/';
        nodes.forEach(function (item) {
            // process image
            if (item.attributes.Image) {
                if (angular.isString(item.attributes.Image)) item.attributes.Image = item.attributes.Image.trim();
                item.attributes.Image=item.attributes.Image.replace('.','-min.');
                item.type = 'image';
                item.url = prefix + item.attributes.Image;
                if (!noRepeat[item.attributes.Image]) {
                    noRepeat[item.attributes.Image] = true;
                    urls.push(prefix + item.attributes.Image);
                }
            } else {
                item.type = 'def';
                item.url = null;
            }
        });
        var noRepeat={};
        edges.forEach(function (item) {
            item.color = '#908BF7';//908BF7,0027cc,0b0085,FE6A37
            item.hidden = false;
            noRepeat[item.source]=true;
            noRepeat[item.target]=true;
        });
        nodes.forEach(function (item) {
            if(noRepeat[item.label]) item.hidden=false; else item.hidden=true;
            item.color = '#908BF7';//#fff,0027cc,0b0085,0070c2
        });

        return urls;
    }
}]);

Fix the incorrect name of avatars