MediaWiki:Gadget-GlossaryGraph.js: Difference between revisions

Jump to navigation Jump to search
AdminIsidore (talk | contribs)
No edit summary
AdminIsidore (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 68: Line 68:


                 var node = svg.append('g')
                 var node = svg.append('g')
                     .selectAll('circle')
                     .selectAll('g')
                     .data(nodes)
                     .data(nodes)
                     .enter().append('circle')
                     .enter().append('g')
                    .attr('r', 10)
                    .attr('fill', '#00CC00')
                     .call(d3.drag()
                     .call(d3.drag()
                         .on('start', function(event, d) {
                         .on('start', function(event, d) {
Line 88: Line 86:
                             d.fy = null;
                             d.fy = null;
                         }));
                         }));
                node.append('circle')
                    .attr('r', 10)
                    .attr('fill', '#00CC00');
                node.append('text')
                    .attr('dx', 12)
                    .attr('dy', '.35em')
                    .text(d => d.id.split(':').pop()) // Show short term name (e.g., "Dictum")
                    .style('fill', '#00FF00')
                    .style('font-family', 'IBMPlexMono, "Courier New", monospace')
                    .style('font-size', '12px');


                 node.append('title').text(d => d.id);
                 node.append('title').text(d => d.id);
Line 96: Line 106:
                         .attr('x2', d => d.target.x)
                         .attr('x2', d => d.target.x)
                         .attr('y2', d => d.target.y);
                         .attr('y2', d => d.target.y);
                     node.attr('cx', d => d.x)
                     node.attr('transform', d => `translate(${d.x},${d.y})`);
                        .attr('cy', d => d.y);
                 });
                 });
             }).fail(function(jqXHR, textStatus, errorThrown) {
             }).fail(function(jqXHR, textStatus, errorThrown) {