@@ -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:
226270co_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-
281323chart = {
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