Skip to content

Commit 1a22ae2

Browse files
committed
remove remainingContributors and related visualization code
1 parent f3eafb2 commit 1a22ae2

File tree

12 files changed

+32
-279
lines changed

12 files changed

+32
-279
lines changed

js/chart.js

Lines changed: 12 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {
2929
import {
3030
createRepoRadiusScale,
3131
createContributorRadiusScale,
32-
createRemainingContributorRadiusScale,
3332
createLinkDistanceScale,
3433
createLinkWidthScale
3534
} from './config/scales.js';
@@ -57,8 +56,7 @@ import {
5756
import {
5857
runOwnerSimulation,
5958
runContributorSimulation,
60-
runCollaborationSimulation,
61-
runRemainingSimulation
59+
runCollaborationSimulation
6260
} from './simulations/index.js';
6361
import {
6462
createFilterState,
@@ -175,7 +173,7 @@ const createContributorNetworkVisual = (
175173
let visibleContributors;
176174

177175
// Datasets
178-
let contributors, remainingContributors;
176+
let contributors;
179177
let repos;
180178
let nodes = [],
181179
nodes_central;
@@ -192,13 +190,11 @@ const createContributorNetworkVisual = (
192190
// These are kept in sync with interactionState and delaunayData object
193191
let delaunay;
194192
let nodes_delaunay;
195-
let delaunay_remaining;
196-
193+
197194
// Helper to sync local variables with delaunayData
198195
function syncDelaunayVars(delaunayData) {
199196
delaunay = delaunayData.delaunay;
200197
nodes_delaunay = delaunayData.nodesDelaunay;
201-
delaunay_remaining = delaunayData.delaunayRemaining;
202198
}
203199

204200
/////////////////////////////////////////////////////////////////
@@ -218,7 +214,6 @@ const createContributorNetworkVisual = (
218214
const MAX_CONTRIBUTOR_WIDTH = LAYOUT.maxContributorWidth; // The maximum width (at SF = 1) of the contributor name before it gets wrapped
219215
const CONTRIBUTOR_PADDING = contributor_padding; // The padding between the contributor nodes around the circle (at SF = 1)
220216

221-
let REMAINING_PRESENT = false; // Is the dataset of remaining contributors present?
222217

223218
/////////////////////////////////////////////////////////////////
224219
///////////////////////////// Colors ////////////////////////////
@@ -332,7 +327,6 @@ const createContributorNetworkVisual = (
332327

333328
// Based on the number of commits to the central repo
334329
const scale_contributor_radius = createContributorRadiusScale(d3);
335-
const scale_remaining_contributor_radius = createRemainingContributorRadiusScale(d3);
336330

337331
const scale_link_distance = createLinkDistanceScale(d3);
338332

@@ -355,27 +349,16 @@ const createContributorNetworkVisual = (
355349
// Initialize filters to show all
356350
applyFilters();
357351

358-
// contributors, repos, links are now set by applyFilters
359-
if (values[3]) {
360-
// Check if there is a column called "author_name" in the dataset
361-
if (values[3][0].author_name !== undefined) {
362-
remainingContributors = values[3];
363-
REMAINING_PRESENT = true;
364-
} // if
365-
} // if
366-
367352
// Prepare data using extracted module
368353
const prepared = prepareData(
369354
{
370355
contributors,
371356
repos,
372-
links,
373-
remainingContributors: REMAINING_PRESENT ? remainingContributors : []
357+
links
374358
},
375359
{
376360
d3,
377361
REPO_CENTRAL,
378-
REMAINING_PRESENT,
379362
COLOR_CONTRIBUTOR,
380363
COLOR_REPO,
381364
COLOR_OWNER,
@@ -390,8 +373,7 @@ const createContributorNetworkVisual = (
390373
{
391374
scale_repo_radius,
392375
scale_contributor_radius,
393-
scale_link_width,
394-
scale_remaining_contributor_radius
376+
scale_link_width
395377
}
396378
);
397379

@@ -471,26 +453,6 @@ const createContributorNetworkVisual = (
471453
);
472454
// console.log("Central force simulation done")
473455

474-
/////////////////////////////////////////////////////////////
475-
////// Run Force Simulation for Remaining Contributors //////
476-
/////////////////////////////////////////////////////////////
477-
// Run a force simulation to position the remaining contributors around the central area
478-
if (REMAINING_PRESENT) {
479-
runRemainingSimulation(
480-
remainingContributors,
481-
d3,
482-
TAU,
483-
cos,
484-
sin,
485-
max,
486-
RADIUS_CONTRIBUTOR,
487-
CONTRIBUTOR_RING_WIDTH,
488-
DEFAULT_SIZE,
489-
scale_remaining_contributor_radius
490-
);
491-
}
492-
// console.log("Remaining contributor force simulation done")
493-
494456
/////////////////////////////////////////////////////////////
495457
////////////// Resolve String References in Links ///////////
496458
/////////////////////////////////////////////////////////////
@@ -606,12 +568,10 @@ const createContributorNetworkVisual = (
606568
PIXEL_RATIO,
607569
SF,
608570
nodes_delaunay,
609-
delaunay,
610-
delaunay_remaining
571+
delaunay
611572
};
612573
const data = {
613-
nodes,
614-
remainingContributors
574+
nodes
615575
};
616576

617577
// Update local variables from state object BEFORE calling handleResize
@@ -630,7 +590,6 @@ const createContributorNetworkVisual = (
630590
SF = state.SF;
631591
nodes_delaunay = state.nodes_delaunay;
632592
delaunay = state.delaunay;
633-
delaunay_remaining = state.delaunay_remaining;
634593
// Now draw with updated values
635594
draw();
636595
};
@@ -642,7 +601,6 @@ const createContributorNetworkVisual = (
642601
state,
643602
data,
644603
{
645-
REMAINING_PRESENT,
646604
d3,
647605
setDelaunay,
648606
interactionState,
@@ -657,8 +615,7 @@ const createContributorNetworkVisual = (
657615
SF = state.SF;
658616
nodes_delaunay = state.nodes_delaunay;
659617
delaunay = state.delaunay;
660-
delaunay_remaining = state.delaunay_remaining;
661-
618+
662619
// Debug: Log after resize
663620
console.log('chart.resize() completed', { WIDTH, HEIGHT, SF, nodesCount: nodes.length });
664621
}; //function resize
@@ -763,11 +720,6 @@ const createContributorNetworkVisual = (
763720
/////////////////////////////////////////////////////////////////
764721
// Extracted to src/js/simulations/collaborationSimulation.js
765722

766-
/////////////////////////////////////////////////////////////////
767-
///////////// Force Simulation | Other Contributors /////////////
768-
/////////////////////////////////////////////////////////////////
769-
// Extracted to src/js/simulations/remainingSimulation.js
770-
771723

772724
/////////////////////////////////////////////////////////////////
773725
///////////////////// Node Drawing Functions ////////////////////
@@ -962,10 +914,8 @@ const createContributorNetworkVisual = (
962914
set delaunay(val) { delaunay = val; },
963915
get nodesDelaunay() { return nodes_delaunay; },
964916
set nodesDelaunay(val) { nodes_delaunay = val; },
965-
get delaunayRemaining() { return delaunay_remaining; },
966-
set delaunayRemaining(val) { delaunay_remaining = val; }
967917
};
968-
918+
969919
setupHoverInteraction({
970920
d3,
971921
canvasSelector: "#canvas-hover",
@@ -975,8 +925,6 @@ const createContributorNetworkVisual = (
975925
REPO_CENTRAL,
976926
canvas,
977927
contextHover: context_hover,
978-
REMAINING_PRESENT,
979-
remainingContributors,
980928
setHovered,
981929
clearHover,
982930
drawHoverState,
@@ -1131,10 +1079,8 @@ const createContributorNetworkVisual = (
11311079
set delaunay(val) { delaunay = val; },
11321080
get nodesDelaunay() { return nodes_delaunay; },
11331081
set nodesDelaunay(val) { nodes_delaunay = val; },
1134-
get delaunayRemaining() { return delaunay_remaining; },
1135-
set delaunayRemaining(val) { delaunay_remaining = val; }
11361082
};
1137-
1083+
11381084
setupClickInteraction({
11391085
d3,
11401086
canvasSelector: "#canvas-hover", // Use hover canvas for clicks too since it's on top
@@ -1146,8 +1092,6 @@ const createContributorNetworkVisual = (
11461092
contextClick: context_click,
11471093
contextHover: context_hover,
11481094
nodes,
1149-
REMAINING_PRESENT,
1150-
remainingContributors,
11511095
setClicked,
11521096
clearClick,
11531097
clearHover,
@@ -1310,7 +1254,6 @@ const createContributorNetworkVisual = (
13101254
// Reset spatial data structures (will be rebuilt in resize())
13111255
nodes_delaunay = [];
13121256
delaunay = null;
1313-
delaunay_remaining = null;
13141257
// Note: clearDelaunay already called above via clearAll
13151258

13161259
// Apply current filters
@@ -1321,13 +1264,11 @@ const createContributorNetworkVisual = (
13211264
{
13221265
contributors,
13231266
repos,
1324-
links,
1325-
remainingContributors: REMAINING_PRESENT ? remainingContributors : []
1267+
links
13261268
},
13271269
{
13281270
d3,
13291271
REPO_CENTRAL,
1330-
REMAINING_PRESENT,
13311272
COLOR_CONTRIBUTOR,
13321273
COLOR_REPO,
13331274
COLOR_OWNER,
@@ -1342,8 +1283,7 @@ const createContributorNetworkVisual = (
13421283
{
13431284
scale_repo_radius,
13441285
scale_contributor_radius,
1345-
scale_link_width,
1346-
scale_remaining_contributor_radius
1286+
scale_link_width
13471287
}
13481288
);
13491289

@@ -1395,21 +1335,6 @@ const createContributorNetworkVisual = (
13951335
INNER_RADIUS_FACTOR
13961336
}
13971337
);
1398-
if (REMAINING_PRESENT) {
1399-
runRemainingSimulation(
1400-
remainingContributors,
1401-
d3,
1402-
TAU,
1403-
cos,
1404-
sin,
1405-
max,
1406-
RADIUS_CONTRIBUTOR,
1407-
CONTRIBUTOR_RING_WIDTH,
1408-
DEFAULT_SIZE,
1409-
scale_remaining_contributor_radius
1410-
);
1411-
}
1412-
14131338
// Resolve any remaining string references in links
14141339
links = resolveLinkReferences(links, nodes);
14151340

js/config/scales.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,6 @@ export function createContributorRadiusScale(d3) {
3333
.range([SIZES.contributorRadius.min, SIZES.contributorRadius.max]);
3434
}
3535

36-
/**
37-
* Create the remaining contributor radius scale.
38-
* Used for contributors outside the main ring.
39-
*
40-
* @param {Object} d3 - D3 library reference
41-
* @returns {Function} D3 scale function
42-
*/
43-
export function createRemainingContributorRadiusScale(d3) {
44-
return d3.scaleSqrt()
45-
.range([SIZES.remainingContributorRadius.min, SIZES.remainingContributorRadius.max]);
46-
}
47-
4836
/**
4937
* Create the link distance scale.
5038
* Maps connection strength to link length.
@@ -81,7 +69,6 @@ export function createAllScales(d3) {
8169
return {
8270
repoRadius: createRepoRadiusScale(d3),
8371
contributorRadius: createContributorRadiusScale(d3),
84-
remainingContributorRadius: createRemainingContributorRadiusScale(d3),
8572
linkDistance: createLinkDistanceScale(d3),
8673
linkWidth: createLinkWidthScale(d3)
8774
};

js/config/theme.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export const SIZES = {
5959

6060
// Node radius ranges [min, max]
6161
contributorRadius: { min: 8, max: 30 },
62-
remainingContributorRadius: { min: 1, max: 8 },
6362
repoRadius: { min: 4, max: 20 },
6463

6564
// Link dimensions

js/data/prepare.js

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,9 @@ function parseRepoString(repoString) {
8484
* - contributors: Array of contributor objects
8585
* - repos: Array of repository objects
8686
* - links: Array of link objects
87-
* - remainingContributors: Array of remaining contributor objects (optional)
8887
* @param {Object} config - Configuration:
8988
* - d3: D3 library instance
9089
* - REPO_CENTRAL: Central repository identifier
91-
* - REMAINING_PRESENT: Whether remaining contributors are present
9290
* - COLOR_CONTRIBUTOR: Color for contributor nodes
9391
* - COLOR_REPO: Color for repository nodes
9492
* - COLOR_OWNER: Color for owner nodes
@@ -103,7 +101,6 @@ function parseRepoString(repoString) {
103101
* - scale_repo_radius: Scale for repository node radius
104102
* - scale_contributor_radius: Scale for contributor node radius
105103
* - scale_link_width: Scale for link width
106-
* - scale_remaining_contributor_radius: Scale for remaining contributor radius
107104
* @returns {Object} Prepared data:
108105
* - nodes: Array of node objects
109106
* - central_repo: Central repository node
@@ -114,14 +111,12 @@ export function prepareData(data, config, scales) {
114111
const {
115112
contributors,
116113
repos,
117-
links,
118-
remainingContributors = []
114+
links
119115
} = data;
120116

121117
const {
122118
d3,
123119
REPO_CENTRAL,
124-
REMAINING_PRESENT,
125120
COLOR_CONTRIBUTOR,
126121
COLOR_REPO,
127122
COLOR_OWNER,
@@ -137,8 +132,7 @@ export function prepareData(data, config, scales) {
137132
const {
138133
scale_repo_radius,
139134
scale_contributor_radius,
140-
scale_link_width,
141-
scale_remaining_contributor_radius
135+
scale_link_width
142136
} = scales;
143137

144138
// Create date formatters
@@ -250,32 +244,6 @@ export function prepareData(data, config, scales) {
250244
delete d.author_name;
251245
});
252246

253-
// ============================================================
254-
// Prepare Remaining Contributors
255-
// ============================================================
256-
// Guard against undefined remainingContributors array
257-
if (REMAINING_PRESENT && Array.isArray(remainingContributors) && remainingContributors.length > 0) {
258-
remainingContributors.forEach((d, idx) => {
259-
d.commit_count = +d.commit_count;
260-
261-
// Parse dates with validation
262-
const remainingId = d.author_name || `remaining_contributor_${idx}`;
263-
if (isInteger(d.commit_sec_min)) {
264-
d.commit_sec_min = safeParsDate(d.commit_sec_min, parseDateUnix, 'commit_sec_min', remainingId);
265-
d.commit_sec_max = safeParsDate(d.commit_sec_max, parseDateUnix, 'commit_sec_max', remainingId);
266-
} else {
267-
d.commit_sec_min = safeParsDate(d.commit_sec_min, parseDate, 'commit_sec_min', remainingId);
268-
d.commit_sec_max = safeParsDate(d.commit_sec_max, parseDate, 'commit_sec_max', remainingId);
269-
}
270-
271-
d.type = "contributor";
272-
d.remaining_contributor = true;
273-
d.color = COLOR_CONTRIBUTOR;
274-
});
275-
} else if (REMAINING_PRESENT && (!Array.isArray(remainingContributors) || remainingContributors.length === 0)) {
276-
debugWarn('REMAINING_PRESENT is true but remainingContributors array is empty or invalid');
277-
}
278-
279247
// ============================================================
280248
// Create Nodes
281249
// ============================================================
@@ -581,11 +549,6 @@ export function prepareData(data, config, scales) {
581549
scale_link_width.domain([1, 10, 60]); // fallback
582550
}
583551

584-
scale_remaining_contributor_radius.domain([
585-
0,
586-
scale_contributor_radius.domain()[0],
587-
]);
588-
589552
// ============================================================
590553
// Calculate Node Properties
591554
// ============================================================

0 commit comments

Comments
 (0)