This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (global, factory) { | |
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dispatch'), require('d3-drag'), require('d3-interpolate'), require('d3-selection'), require('d3-transition')) : | |
typeof define === 'function' && define.amd ? define(['exports', 'd3-dispatch', 'd3-drag', 'd3-interpolate', 'd3-selection', 'd3-transition'], factory) : | |
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3)); | |
}(this, (function (exports,d3Dispatch,d3Drag,d3Interpolate,d3Selection,d3Transition) { 'use strict'; | |
var constant = function(x) { | |
return function() { | |
return x; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// only show edges related to node on click | |
allEdges = $('.edge'); | |
allNodes = $('.node') | |
node.on("click", function(d) { | |
var id = d.id.toString(); | |
allEdges.removeClass('hidden'); | |
allNodes.removeClass('hidden'); | |
nonRelevantEdges = $('.edge:not(.' + id + ')'); | |
nonRelevantEdges.toggleClass('hidden'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div.tooltip { | |
position: absolute; | |
text-align: center; | |
padding: 4px; | |
font: 12px sans-serif; | |
background: white; | |
border: 0px; | |
border-radius: 3px; | |
pointer-events: none; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
function getGradID(d){return "linkGrad-" + d.source + "-"+ d.target;} | |
var defs = d3v4.select("svg").append("defs"); | |
var grads = defs.selectAll("linearGradient") | |
.data(graph.links); | |
var lingrads = grads.enter().append("linearGradient"); | |
lingrads.attr("id", getGradID) |