@graphty/layout 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,362 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Bipartite Layout Test</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 0;
11
+ padding: 20px;
12
+ background-color: #f5f5f5;
13
+ }
14
+ .container {
15
+ max-width: 1400px;
16
+ margin: 0 auto;
17
+ display: grid;
18
+ grid-template-columns: 250px 1fr 250px;
19
+ gap: 20px;
20
+ }
21
+ .graph-controls {
22
+ background: white;
23
+ padding: 20px;
24
+ border-radius: 8px;
25
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
26
+ height: fit-content;
27
+ }
28
+ .layout-controls {
29
+ background: white;
30
+ padding: 20px;
31
+ border-radius: 8px;
32
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
33
+ height: fit-content;
34
+ }
35
+ .visualization {
36
+ background: white;
37
+ border-radius: 8px;
38
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
39
+ padding: 20px;
40
+ }
41
+ .control-group {
42
+ margin-bottom: 15px;
43
+ }
44
+ label {
45
+ display: block;
46
+ margin-bottom: 5px;
47
+ font-weight: bold;
48
+ color: #333;
49
+ }
50
+ input[type="range"], input[type="number"], select {
51
+ width: 100%;
52
+ padding: 5px;
53
+ border: 1px solid #ddd;
54
+ border-radius: 4px;
55
+ }
56
+ button {
57
+ background: #4CAF50;
58
+ color: white;
59
+ border: none;
60
+ padding: 10px 15px;
61
+ border-radius: 4px;
62
+ cursor: pointer;
63
+ width: 100%;
64
+ margin: 5px 0;
65
+ }
66
+ button:hover {
67
+ background: #45a049;
68
+ }
69
+ #graph-svg {
70
+ border: 1px solid #ddd;
71
+ border-radius: 4px;
72
+ }
73
+ .back-link {
74
+ margin-bottom: 20px;
75
+ }
76
+ .back-link a {
77
+ color: #2c5aa0;
78
+ text-decoration: none;
79
+ }
80
+ .back-link a:hover {
81
+ text-decoration: underline;
82
+ }
83
+ .partition-info {
84
+ background: #f0f7ff;
85
+ border: 1px solid #c0d7f0;
86
+ border-radius: 4px;
87
+ padding: 10px;
88
+ margin-top: 15px;
89
+ font-size: 0.85em;
90
+ }
91
+ </style>
92
+ </head>
93
+ <body>
94
+ <div class="back-link">
95
+ <a href="index.html">← Back to Index</a>
96
+ </div>
97
+
98
+ <h1>Bipartite Layout Test</h1>
99
+
100
+ <div class="container">
101
+ <div class="graph-controls">
102
+ <h3>Graph Settings</h3>
103
+
104
+ <div class="control-group">
105
+ <label for="num-nodes">Total number of nodes:</label>
106
+ <input type="range" id="num-nodes" min="4" max="20" value="12">
107
+ <span id="num-nodes-value">12</span>
108
+ </div>
109
+
110
+ <div class="control-group">
111
+ <label for="partition-ratio">Partition ratio (A:B):</label>
112
+ <input type="range" id="partition-ratio" min="0.2" max="0.8" step="0.1" value="0.5">
113
+ <span id="partition-ratio-value">50%-50%</span>
114
+ </div>
115
+
116
+ <div class="control-group">
117
+ <label for="edge-density">Edge density:</label>
118
+ <input type="range" id="edge-density" min="0.1" max="1" step="0.1" value="0.3">
119
+ <span id="edge-density-value">0.3</span>
120
+ </div>
121
+
122
+ <button onclick="newGraph()">New Graph</button>
123
+ <div id="partition-info" class="partition-info"></div>
124
+ </div>
125
+
126
+ <div class="visualization">
127
+ <svg id="graph-svg" width="800" height="600"></svg>
128
+ </div>
129
+
130
+ <div class="layout-controls">
131
+ <h3>Layout Parameters</h3>
132
+
133
+ <div class="control-group">
134
+ <label for="alignment">Alignment:</label>
135
+ <select id="alignment">
136
+ <option value="vertical">Vertical</option>
137
+ <option value="horizontal">Horizontal</option>
138
+ </select>
139
+ </div>
140
+
141
+ <div class="control-group">
142
+ <label for="aspect-ratio">Aspect Ratio:</label>
143
+ <input type="range" id="aspect-ratio" min="0.5" max="3" step="0.1" value="1.33">
144
+ <span id="aspect-ratio-value">1.33</span>
145
+ </div>
146
+
147
+ <button onclick="applyLayout()">Apply Layout</button>
148
+ </div>
149
+ </div>
150
+
151
+ <script type="module">
152
+ import { bipartiteLayout } from './layout.js';
153
+
154
+ let currentGraph = null;
155
+
156
+ function generateBipartiteGraph(totalNodes, partitionRatio, edgeDensity) {
157
+ const setASize = Math.round(totalNodes * partitionRatio);
158
+ const setBSize = totalNodes - setASize;
159
+
160
+ const setA = Array.from({length: setASize}, (_, i) => `A${i}`);
161
+ const setB = Array.from({length: setBSize}, (_, i) => `B${i}`);
162
+ const allNodes = [...setA, ...setB];
163
+
164
+ const edges = [];
165
+ const maxEdges = setASize * setBSize;
166
+ const targetEdges = Math.floor(maxEdges * edgeDensity);
167
+
168
+ // Generate random bipartite edges (only between setA and setB)
169
+ for (let i = 0; i < targetEdges; i++) {
170
+ const nodeA = setA[Math.floor(Math.random() * setA.length)];
171
+ const nodeB = setB[Math.floor(Math.random() * setB.length)];
172
+
173
+ // Check if edge already exists
174
+ const edgeExists = edges.some(([s, t]) =>
175
+ (s === nodeA && t === nodeB) || (s === nodeB && t === nodeA)
176
+ );
177
+
178
+ if (!edgeExists) {
179
+ edges.push([nodeA, nodeB]);
180
+ }
181
+ }
182
+
183
+ return {
184
+ nodes: () => allNodes,
185
+ edges: () => edges,
186
+ setA,
187
+ setB
188
+ };
189
+ }
190
+
191
+ function visualizeGraph(graph, positions) {
192
+ const svg = document.getElementById('graph-svg');
193
+ const svgRect = svg.getBoundingClientRect();
194
+ const width = svgRect.width;
195
+ const height = svgRect.height;
196
+
197
+ svg.innerHTML = '';
198
+
199
+ const margin = 50;
200
+ const scaleX = (width - 2 * margin);
201
+ const scaleY = (height - 2 * margin);
202
+
203
+ const nodes = graph.nodes();
204
+ const posValues = nodes.map(n => positions[n]);
205
+ const minX = Math.min(...posValues.map(p => p[0]));
206
+ const maxX = Math.max(...posValues.map(p => p[0]));
207
+ const minY = Math.min(...posValues.map(p => p[1]));
208
+ const maxY = Math.max(...posValues.map(p => p[1]));
209
+
210
+ const rangeX = maxX - minX || 1;
211
+ const rangeY = maxY - minY || 1;
212
+
213
+ // Draw edges
214
+ const edges = graph.edges();
215
+ edges.forEach(([source, target]) => {
216
+ const sourcePos = positions[source];
217
+ const targetPos = positions[target];
218
+
219
+ const x1 = margin + (sourcePos[0] - minX) / rangeX * scaleX;
220
+ const y1 = margin + (sourcePos[1] - minY) / rangeY * scaleY;
221
+ const x2 = margin + (targetPos[0] - minX) / rangeX * scaleX;
222
+ const y2 = margin + (targetPos[1] - minY) / rangeY * scaleY;
223
+
224
+ const line = document.createElementNS('http://www.w3.org/2000/svg', 'line');
225
+ line.setAttribute('x1', x1);
226
+ line.setAttribute('y1', y1);
227
+ line.setAttribute('x2', x2);
228
+ line.setAttribute('y2', y2);
229
+ line.setAttribute('stroke', '#999');
230
+ line.setAttribute('stroke-width', '2');
231
+ svg.appendChild(line);
232
+ });
233
+
234
+ // Draw nodes with different colors for set A and B
235
+ nodes.forEach(node => {
236
+ const pos = positions[node];
237
+ const x = margin + (pos[0] - minX) / rangeX * scaleX;
238
+ const y = margin + (pos[1] - minY) / rangeY * scaleY;
239
+
240
+ // Determine color based on set
241
+ const isSetA = graph.setA.includes(node);
242
+ const color = isSetA ? '#E91E63' : '#2196F3';
243
+
244
+ const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
245
+ circle.setAttribute('cx', x);
246
+ circle.setAttribute('cy', y);
247
+ circle.setAttribute('r', '8');
248
+ circle.setAttribute('fill', color);
249
+ circle.setAttribute('stroke', '#333');
250
+ circle.setAttribute('stroke-width', '2');
251
+ svg.appendChild(circle);
252
+
253
+ const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
254
+ text.setAttribute('x', x);
255
+ text.setAttribute('y', y + 4);
256
+ text.setAttribute('text-anchor', 'middle');
257
+ text.setAttribute('font-size', '10');
258
+ text.setAttribute('fill', 'white');
259
+ text.textContent = node;
260
+ svg.appendChild(text);
261
+ });
262
+
263
+ // Add legend
264
+ const legendGroup = document.createElementNS('http://www.w3.org/2000/svg', 'g');
265
+
266
+ // Set A
267
+ const circleA = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
268
+ circleA.setAttribute('cx', width - 100);
269
+ circleA.setAttribute('cy', 30);
270
+ circleA.setAttribute('r', '6');
271
+ circleA.setAttribute('fill', '#E91E63');
272
+ circleA.setAttribute('stroke', '#333');
273
+ legendGroup.appendChild(circleA);
274
+
275
+ const textA = document.createElementNS('http://www.w3.org/2000/svg', 'text');
276
+ textA.setAttribute('x', width - 85);
277
+ textA.setAttribute('y', 35);
278
+ textA.setAttribute('font-size', '12');
279
+ textA.textContent = 'Set A';
280
+ legendGroup.appendChild(textA);
281
+
282
+ // Set B
283
+ const circleB = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
284
+ circleB.setAttribute('cx', width - 100);
285
+ circleB.setAttribute('cy', 50);
286
+ circleB.setAttribute('r', '6');
287
+ circleB.setAttribute('fill', '#2196F3');
288
+ circleB.setAttribute('stroke', '#333');
289
+ legendGroup.appendChild(circleB);
290
+
291
+ const textB = document.createElementNS('http://www.w3.org/2000/svg', 'text');
292
+ textB.setAttribute('x', width - 85);
293
+ textB.setAttribute('y', 55);
294
+ textB.setAttribute('font-size', '12');
295
+ textB.textContent = 'Set B';
296
+ legendGroup.appendChild(textB);
297
+
298
+ svg.appendChild(legendGroup);
299
+ }
300
+
301
+ window.newGraph = function() {
302
+ const totalNodes = parseInt(document.getElementById('num-nodes').value);
303
+ const partitionRatio = parseFloat(document.getElementById('partition-ratio').value);
304
+ const edgeDensity = parseFloat(document.getElementById('edge-density').value);
305
+
306
+ currentGraph = generateBipartiteGraph(totalNodes, partitionRatio, edgeDensity);
307
+
308
+ // Just visualize with random positions initially
309
+ const positions = {};
310
+ currentGraph.nodes().forEach(node => {
311
+ positions[node] = [
312
+ (Math.random() - 0.5) * 1.5,
313
+ (Math.random() - 0.5) * 1.5
314
+ ];
315
+ });
316
+
317
+ visualizeGraph(currentGraph, positions);
318
+
319
+ // Update partition info
320
+ const infoDiv = document.getElementById('partition-info');
321
+ infoDiv.innerHTML = `
322
+ <strong>Partition:</strong><br>
323
+ Set A: ${currentGraph.setA.length} nodes (${((currentGraph.setA.length / totalNodes) * 100).toFixed(1)}%)<br>
324
+ Set B: ${currentGraph.setB.length} nodes (${((currentGraph.setB.length / totalNodes) * 100).toFixed(1)}%)<br>
325
+ Edges: ${currentGraph.edges().length}
326
+ `;
327
+ };
328
+
329
+ window.applyLayout = function() {
330
+ if (!currentGraph) return;
331
+
332
+ const alignment = document.getElementById('alignment').value;
333
+ const aspectRatio = parseFloat(document.getElementById('aspect-ratio').value);
334
+
335
+ const positions = bipartiteLayout(currentGraph, currentGraph.setA, alignment, 1, [0, 0], aspectRatio);
336
+
337
+ visualizeGraph(currentGraph, positions);
338
+ };
339
+
340
+ function setupControls() {
341
+ const controls = ['num-nodes', 'partition-ratio', 'aspect-ratio', 'edge-density'];
342
+ controls.forEach(id => {
343
+ const slider = document.getElementById(id);
344
+ const valueSpan = document.getElementById(id + '-value');
345
+ slider.oninput = function() {
346
+ if (id === 'partition-ratio') {
347
+ const ratio = parseFloat(this.value);
348
+ valueSpan.textContent = `${(ratio * 100).toFixed(0)}%-${((1 - ratio) * 100).toFixed(0)}%`;
349
+ } else {
350
+ valueSpan.textContent = this.value;
351
+ }
352
+ };
353
+ });
354
+
355
+ document.getElementById('alignment').onchange = null;
356
+ }
357
+
358
+ setupControls();
359
+ newGraph();
360
+ </script>
361
+ </body>
362
+ </html>
@@ -0,0 +1,301 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Circular Layout Test</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 0;
11
+ padding: 20px;
12
+ background-color: #f5f5f5;
13
+ }
14
+ .container {
15
+ max-width: 1400px;
16
+ margin: 0 auto;
17
+ display: grid;
18
+ grid-template-columns: 250px 1fr 250px;
19
+ gap: 20px;
20
+ }
21
+ .graph-controls {
22
+ background: white;
23
+ padding: 20px;
24
+ border-radius: 8px;
25
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
26
+ height: fit-content;
27
+ }
28
+ .layout-controls {
29
+ background: white;
30
+ padding: 20px;
31
+ border-radius: 8px;
32
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
33
+ height: fit-content;
34
+ }
35
+ .visualization {
36
+ background: white;
37
+ border-radius: 8px;
38
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
39
+ padding: 20px;
40
+ }
41
+ .control-group {
42
+ margin-bottom: 15px;
43
+ }
44
+ label {
45
+ display: block;
46
+ margin-bottom: 5px;
47
+ font-weight: bold;
48
+ color: #333;
49
+ }
50
+ input[type="range"], input[type="number"], select {
51
+ width: 100%;
52
+ padding: 5px;
53
+ border: 1px solid #ddd;
54
+ border-radius: 4px;
55
+ }
56
+ button {
57
+ background: #4CAF50;
58
+ color: white;
59
+ border: none;
60
+ padding: 10px 15px;
61
+ border-radius: 4px;
62
+ cursor: pointer;
63
+ width: 100%;
64
+ margin: 5px 0;
65
+ }
66
+ button:hover {
67
+ background: #45a049;
68
+ }
69
+ #graph-svg {
70
+ border: 1px solid #ddd;
71
+ border-radius: 4px;
72
+ }
73
+ .back-link {
74
+ margin-bottom: 20px;
75
+ }
76
+ .back-link a {
77
+ color: #2c5aa0;
78
+ text-decoration: none;
79
+ }
80
+ .back-link a:hover {
81
+ text-decoration: underline;
82
+ }
83
+ </style>
84
+ </head>
85
+ <body>
86
+ <div class="back-link">
87
+ <a href="index.html">← Back to Index</a>
88
+ </div>
89
+
90
+ <h1>Circular Layout Test</h1>
91
+
92
+ <div class="container">
93
+ <div class="graph-controls">
94
+ <h3>Graph Settings</h3>
95
+
96
+ <div class="control-group">
97
+ <label for="num-nodes">Number of nodes:</label>
98
+ <input type="range" id="num-nodes" min="3" max="30" value="12">
99
+ <span id="num-nodes-value">12</span>
100
+ </div>
101
+
102
+ <div class="control-group">
103
+ <label for="graph-type">Graph type:</label>
104
+ <select id="graph-type">
105
+ <option value="cycle">Cycle</option>
106
+ <option value="random">Random</option>
107
+ <option value="complete">Complete</option>
108
+ <option value="wheel">Wheel</option>
109
+ </select>
110
+ </div>
111
+
112
+ <button onclick="newGraph()">New Graph</button>
113
+ </div>
114
+
115
+ <div class="visualization">
116
+ <svg id="graph-svg" width="800" height="600"></svg>
117
+ </div>
118
+
119
+ <div class="layout-controls">
120
+ <h3>Layout Parameters</h3>
121
+
122
+ <div class="control-group">
123
+ <label for="center-x">Center X:</label>
124
+ <input type="range" id="center-x" min="-1" max="1" step="0.1" value="0">
125
+ <span id="center-x-value">0.0</span>
126
+ </div>
127
+
128
+ <div class="control-group">
129
+ <label for="center-y">Center Y:</label>
130
+ <input type="range" id="center-y" min="-1" max="1" step="0.1" value="0">
131
+ <span id="center-y-value">0.0</span>
132
+ </div>
133
+
134
+ <button onclick="applyLayout()">Apply Layout</button>
135
+ </div>
136
+ </div>
137
+
138
+ <script type="module">
139
+ import { circularLayout } from './layout.js';
140
+
141
+ let currentGraph = null;
142
+
143
+ function generateGraph(type, numNodes) {
144
+ const nodes = Array.from({length: numNodes}, (_, i) => i);
145
+ const edges = [];
146
+
147
+ switch(type) {
148
+ case 'complete':
149
+ for(let i = 0; i < numNodes; i++) {
150
+ for(let j = i + 1; j < numNodes; j++) {
151
+ edges.push([i, j]);
152
+ }
153
+ }
154
+ break;
155
+ case 'cycle':
156
+ for(let i = 0; i < numNodes; i++) {
157
+ edges.push([i, (i + 1) % numNodes]);
158
+ }
159
+ break;
160
+ case 'wheel':
161
+ // Center connected to all
162
+ for(let i = 1; i < numNodes; i++) {
163
+ edges.push([0, i]);
164
+ }
165
+ // Outer cycle
166
+ for(let i = 1; i < numNodes; i++) {
167
+ edges.push([i, i === numNodes - 1 ? 1 : i + 1]);
168
+ }
169
+ break;
170
+ case 'random':
171
+ default:
172
+ const numEdges = Math.floor(numNodes * 1.2);
173
+ for(let i = 0; i < numEdges; i++) {
174
+ const a = Math.floor(Math.random() * numNodes);
175
+ const b = Math.floor(Math.random() * numNodes);
176
+ if(a !== b && !edges.some(e => (e[0] === a && e[1] === b) || (e[0] === b && e[1] === a))) {
177
+ edges.push([a, b]);
178
+ }
179
+ }
180
+ break;
181
+ }
182
+
183
+ return { nodes: () => nodes, edges: () => edges };
184
+ }
185
+
186
+ function visualizeGraph(graph, positions) {
187
+ const svg = document.getElementById('graph-svg');
188
+ const svgRect = svg.getBoundingClientRect();
189
+ const width = svgRect.width;
190
+ const height = svgRect.height;
191
+
192
+ svg.innerHTML = '';
193
+
194
+ const margin = 50;
195
+ const scaleX = (width - 2 * margin);
196
+ const scaleY = (height - 2 * margin);
197
+
198
+ const nodes = graph.nodes();
199
+ const posValues = nodes.map(n => positions[n]);
200
+ const minX = Math.min(...posValues.map(p => p[0]));
201
+ const maxX = Math.max(...posValues.map(p => p[0]));
202
+ const minY = Math.min(...posValues.map(p => p[1]));
203
+ const maxY = Math.max(...posValues.map(p => p[1]));
204
+
205
+ const rangeX = maxX - minX || 1;
206
+ const rangeY = maxY - minY || 1;
207
+
208
+ // Draw edges
209
+ const edges = graph.edges();
210
+ edges.forEach(([source, target]) => {
211
+ const sourcePos = positions[source];
212
+ const targetPos = positions[target];
213
+
214
+ const x1 = margin + (sourcePos[0] - minX) / rangeX * scaleX;
215
+ const y1 = margin + (sourcePos[1] - minY) / rangeY * scaleY;
216
+ const x2 = margin + (targetPos[0] - minX) / rangeX * scaleX;
217
+ const y2 = margin + (targetPos[1] - minY) / rangeY * scaleY;
218
+
219
+ const line = document.createElementNS('http://www.w3.org/2000/svg', 'line');
220
+ line.setAttribute('x1', x1);
221
+ line.setAttribute('y1', y1);
222
+ line.setAttribute('x2', x2);
223
+ line.setAttribute('y2', y2);
224
+ line.setAttribute('stroke', '#999');
225
+ line.setAttribute('stroke-width', '2');
226
+ svg.appendChild(line);
227
+ });
228
+
229
+ // Draw nodes
230
+ nodes.forEach(node => {
231
+ const pos = positions[node];
232
+ const x = margin + (pos[0] - minX) / rangeX * scaleX;
233
+ const y = margin + (pos[1] - minY) / rangeY * scaleY;
234
+
235
+ const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
236
+ circle.setAttribute('cx', x);
237
+ circle.setAttribute('cy', y);
238
+ circle.setAttribute('r', '8');
239
+ circle.setAttribute('fill', '#2196F3');
240
+ circle.setAttribute('stroke', '#333');
241
+ circle.setAttribute('stroke-width', '2');
242
+ svg.appendChild(circle);
243
+
244
+ const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
245
+ text.setAttribute('x', x);
246
+ text.setAttribute('y', y + 4);
247
+ text.setAttribute('text-anchor', 'middle');
248
+ text.setAttribute('font-size', '12');
249
+ text.setAttribute('fill', 'white');
250
+ text.textContent = node;
251
+ svg.appendChild(text);
252
+ });
253
+ }
254
+
255
+ window.newGraph = function() {
256
+ const numNodes = parseInt(document.getElementById('num-nodes').value);
257
+ const graphType = document.getElementById('graph-type').value;
258
+
259
+ currentGraph = generateGraph(graphType, numNodes);
260
+
261
+ // Just visualize with random positions initially
262
+ const positions = {};
263
+ currentGraph.nodes().forEach(node => {
264
+ positions[node] = [
265
+ (Math.random() - 0.5) * 1.5,
266
+ (Math.random() - 0.5) * 1.5
267
+ ];
268
+ });
269
+
270
+ visualizeGraph(currentGraph, positions);
271
+ };
272
+
273
+ window.applyLayout = function() {
274
+ if(!currentGraph) return;
275
+
276
+ const centerX = parseFloat(document.getElementById('center-x').value);
277
+ const centerY = parseFloat(document.getElementById('center-y').value);
278
+
279
+ const positions = circularLayout(currentGraph, 1, [centerX, centerY], 2);
280
+
281
+ visualizeGraph(currentGraph, positions);
282
+ };
283
+
284
+ function setupControls() {
285
+ const controls = ['num-nodes', 'center-x', 'center-y'];
286
+ controls.forEach(id => {
287
+ const slider = document.getElementById(id);
288
+ const valueSpan = document.getElementById(id + '-value');
289
+ slider.oninput = function() {
290
+ valueSpan.textContent = this.value;
291
+ };
292
+ });
293
+
294
+ document.getElementById('graph-type').onchange = null;
295
+ }
296
+
297
+ setupControls();
298
+ newGraph();
299
+ </script>
300
+ </body>
301
+ </html>