Skip to content

Commit 71567ac

Browse files
committed
add zoom controls to contributors network graph
1 parent 0eb963a commit 71567ac

File tree

3 files changed

+48
-6
lines changed

3 files changed

+48
-6
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: orgmetrics
22
Title: Metrics for Your GitHub Organization
3-
Version: 0.1.2.110
3+
Version: 0.1.2.111
44
Authors@R:
55
person("Mark", "Padgham", , "[email protected]", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2172-5265"))

codemeta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"codeRepository": "https://github.com/ropensci-review-tools/orgmetrics",
99
"issueTracker": "https://github.com/ropensci-review-tools/orgmetrics/issues",
1010
"license": "https://spdx.org/licenses/GPL-3.0",
11-
"version": "0.1.2.110",
11+
"version": "0.1.2.111",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

inst/extdata/quarto/contributor.qmd

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,50 @@ Inputs.table(metricsTable, {
221221

222222
## Network
223223

224+
```{ojs ForceGraph-controls}
225+
width = 928;
226+
height = 600;
227+
228+
viewof x0 = {
229+
let input = Inputs.range([-width, width],
230+
{
231+
value: -width / 2,
232+
step: 10,
233+
label: "x"
234+
}
235+
)
236+
d3.select(input).select('input[type="number"]').style("display", "none");
237+
return input;
238+
}
239+
240+
viewof y0 = {
241+
let input = Inputs.range([-height, height],
242+
{
243+
value: -height / 2,
244+
step: 10,
245+
label: "y"
246+
}
247+
)
248+
d3.select(input).select('input[type="number"]').style("display", "none");
249+
return input;
250+
}
251+
252+
viewof strength = {
253+
let input = Inputs.range([0, 800],
254+
{
255+
value: 50,
256+
step: 10,
257+
label: "zoom"
258+
}
259+
)
260+
d3.select(input).select('input[type="number"]').style("display", "none");
261+
return input;
262+
}
263+
```
264+
265+
266+
<div style="margin-top: 20px; margin-bottom: 20px;"></div>
267+
224268
```{ojs network-in}
225269
// Connect co-maintainers to all of their packages:
226270
co_pkgs = these_cos ? these_cos.map(i => maintainer_pkgs[i]).flat() : [];
@@ -276,8 +320,6 @@ Swatches(chart.scales.color)
276320
```
277321

278322
```{ojs ForceGraph-plot}
279-
strength = -400;
280-
281323
chart = {
282324
283325
const width = 928;
@@ -289,12 +331,12 @@ chart = {
289331
290332
const simulation = d3.forceSimulation(nodes)
291333
.force("link", d3.forceLink(links).id(d => d.id))
292-
.force("charge", d3.forceManyBody().strength(strength))
334+
.force("charge", d3.forceManyBody().strength(-strength))
293335
.force("x", d3.forceX())
294336
.force("y", d3.forceY());
295337
296338
const svg = d3.create("svg")
297-
.attr("viewBox", [-width / 2, -height / 2, width, height])
339+
.attr("viewBox", [x0, y0, width, height])
298340
.attr("width", width)
299341
.attr("height", height)
300342
.attr("style", "max-width: 100%; height: auto; font: 14px sans-serif;");

0 commit comments

Comments
 (0)