Skip to content

Commit 9605bcb

Browse files
committed
Update relationship
1 parent 0fb1ace commit 9605bcb

File tree

4 files changed

+63
-76
lines changed

4 files changed

+63
-76
lines changed

.idea/workspace.xml

Lines changed: 54 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

javascripts/main.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ function draw(data) {
295295
weight: d.weight,
296296
sourceID: d.sourceID,
297297
targetID: d.targetID,
298+
id: d.sourceID + "_" + d.targetID
298299
});
299300
}
300301
});
@@ -307,14 +308,15 @@ function draw(data) {
307308
.domain(d3.extent(visibleLinks, d => d.weight))
308309
.range([0.5, 1]);
309310

310-
var connection = mainGroup.selectAll(".connection").data(visibleLinks);
311+
var connection = mainGroup.selectAll(".connection").data(visibleLinks, d => d.id);
311312
connection.exit().remove();
312313

313314
connection.enter()
314315
.append("line")
315316
.attr("class", "connection");
316317

317-
connection
318+
connection.transition()
319+
.duration(800)
318320
.attr("opacity", isRel ? 1 : 0)
319321
.attr({
320322
"x1": d => d.sourceX,
@@ -330,7 +332,6 @@ function draw(data) {
330332
} else drawWords();
331333

332334
function drawWords() {
333-
var placed = true;
334335
var prevColor;
335336

336337
var texts = mainGroup.selectAll('.word').data(allWords, d => d.id);
@@ -344,11 +345,9 @@ function draw(data) {
344345
}
345346
})
346347
.attr("class", "word")
348+
.append('text')
347349

348-
textEnter.transition()
349-
.duration(800)
350-
351-
textEnter.append('text')
350+
textEnter
352351
.text(function (d) {
353352
return d.text;
354353
})

javascripts/update.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function submitInput(draw) {
1313
globalMinFont = parseInt(document.getElementById("fontMin").innerText);
1414
globalMaxFont = parseInt(document.getElementById("fontMax").innerText);
1515
globalTop = parseInt(document.getElementById("topRankText").innerText);
16-
document.getElementById("rel").checked = false;
16+
// document.getElementById("rel").checked = false;
1717
var isFlow = document.getElementById("flow").checked;
1818
var isAv = document.getElementById("av").checked;
1919
if (isFlow && isAv) {

lib/loaddata.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function loadBlogPostData(draw, top){
88
var outputFormat = d3.time.format('%b %Y');
99
topics = categories;
1010
//Filter and take only dates in 2013
11+
1112
rawData = rawData.filter(function(d){
1213
var time = Date.parse(d.time);
1314
var startDate = inputFormat.parse('2012-12-01T00:00:00');
@@ -23,6 +24,7 @@ function loadBlogPostData(draw, top){
2324
}
2425
return time >= startDate && time < endDate;
2526
});
27+
2628
var data = {};
2729
d3.map(rawData, function(d, i){
2830
var date = Date.parse(d.time);

0 commit comments

Comments
 (0)