function update()

in dashboardv3/public/js/views/graph/RelationshipLayoutView.js [330:462]


                function update() {
                    path = container
                        .append("svg:g")
                        .selectAll("path")
                        .data(links)
                        .enter()
                        .append("svg:path")
                        .attr("class", "relatioship-link")
                        .attr("stroke", function(d) {
                            return getPathColor({ data: d, type: "path" });
                        })
                        .attr("marker-end", function(d) {
                            return "url(#" + (isAllEntityRelationDeleted({ data: d }) ? "deletedLink" : "activeLink") + ")";
                        });

                    node = container
                        .selectAll(".node")
                        .data(nodes)
                        .enter()
                        .append("g")
                        .attr("class", "node")
                        .on("mousedown", function() {
                            console.log(d3.event);
                            d3.event.preventDefault();
                        })
                        .on("click", function(d) {
                            if (d3.event.defaultPrevented) return; // ignore drag
                            if (d && d.value && d.value.guid == that.guid) {
                                that.ui.boxClose.trigger("click");
                                return;
                            }
                            that.toggleBoxPanel({ el: that.$(".relationship-node-details") });
                            that.ui.searchNode.data({ obj: d });
                            $(this)
                                .find("circle")
                                .addClass("node-detail-highlight");
                            that.updateRelationshipDetails({ obj: d });
                        })
                        .call(
                            d3
                            .drag()
                            .on("start", dragstarted)
                            .on("drag", dragged)
                        );

                    var circleContainer = node.append("g");

                    circleContainer
                        .append("circle")
                        .attr("cx", 0)
                        .attr("cy", 0)
                        .attr("r", function(d) {
                            d.radius = 25;
                            return d.radius;
                        })
                        .attr("fill", function(d) {
                            if (d && d.value && d.value.guid == that.guid) {
                                if (isAllEntityRelationDeleted({ data: d, type: "node" })) {
                                    return deletedEntityColor;
                                } else {
                                    return selectedNodeColor;
                                }
                            } else if (isAllEntityRelationDeleted({ data: d, type: "node" })) {
                                return deletedEntityColor;
                            } else {
                                return activeEntityColor;
                            }
                        })
                        .attr("typename", function(d) {
                            return d.name;
                        });

                    circleContainer
                        .append("text")
                        .attr("x", 0)
                        .attr("y", 0)
                        .attr("dy", 25 - 17)
                        .attr("text-anchor", "middle")
                        .style("font-family", "FontAwesome")
                        .style("font-size", function(d) {
                            return "25px";
                        })
                        .text(function(d) {
                            var iconObj = Enums.graphIcon[d.name];
                            if (iconObj && iconObj.textContent) {
                                return iconObj.textContent;
                            } else {
                                if (d && _.isArray(d.value) && d.value.length > 1) {
                                    return "\uf0c5";
                                } else {
                                    return "\uf016";
                                }
                            }
                        })
                        .attr("fill", function(d) {
                            return "#fff";
                        });

                    var countBox = circleContainer.append("g");

                    countBox
                        .append("circle")
                        .attr("cx", 18)
                        .attr("cy", -20)
                        .attr("r", function(d) {
                            if (_.isArray(d.value) && d.value.length > 1) {
                                return 10;
                            }
                        });

                    countBox
                        .append("text")
                        .attr("dx", 18)
                        .attr("dy", -16)
                        .attr("text-anchor", "middle")
                        .attr("fill", defaultEntityColor)
                        .text(function(d) {
                            if (_.isArray(d.value) && d.value.length > 1) {
                                return d.value.length;
                            }
                        });

                    node.append("text")
                        .attr("x", -15)
                        .attr("y", "35")
                        .text(function(d) {
                            return d.name;
                        });

                    simulation.nodes(nodes).on("tick", ticked);

                    simulation.force("link").links(links);
                }