diff options
| author | Dan Fandrich <danf@mageia.org> | 2025-11-17 10:52:02 -0800 |
|---|---|---|
| committer | Dan Fandrich <danf@mageia.org> | 2025-11-17 11:07:44 -0800 |
| commit | 1489ca4d6b3f20784076e930de82c82cc58d57e3 (patch) | |
| tree | c6ac23b0083e9eef6aefc9178c517bfe57531753 /lib/MGA/Mirrors/Controller/Graph.pm | |
| parent | c9d3de96e19a09488452d852bcdefffc5a25129a (diff) | |
| download | mgamirrors-1489ca4d6b3f20784076e930de82c82cc58d57e3.tar mgamirrors-1489ca4d6b3f20784076e930de82c82cc58d57e3.tar.gz mgamirrors-1489ca4d6b3f20784076e930de82c82cc58d57e3.tar.bz2 mgamirrors-1489ca4d6b3f20784076e930de82c82cc58d57e3.tar.xz mgamirrors-1489ca4d6b3f20784076e930de82c82cc58d57e3.zip | |
Set line width on graph proportional to bandwidth
This is already a feature of the Google map, but that's not currently working.
Diffstat (limited to 'lib/MGA/Mirrors/Controller/Graph.pm')
| -rw-r--r-- | lib/MGA/Mirrors/Controller/Graph.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/MGA/Mirrors/Controller/Graph.pm b/lib/MGA/Mirrors/Controller/Graph.pm index 5d39b53..a2b6ad6 100644 --- a/lib/MGA/Mirrors/Controller/Graph.pm +++ b/lib/MGA/Mirrors/Controller/Graph.pm @@ -42,7 +42,12 @@ sub index :Path :Args(0) { $graph->add_node($_, shape => 'box', cluster => $node{$_}{country}); } } - $graph->add_edge($from, $to); + # Minimum bandwidth of both nodes + my $bandwidth = ($node{$from}{bandwidth} < $node{$to}{bandwidth}) ? $node{$from}{bandwidth} : $node{$to}{bandwidth}; + $bandwidth = 1 if (!$bandwidth); + my $thickness = log($bandwidth) / log(3) - 16; # Scale line thickness from bandwidth + $thickness = ($thickness < 1) ? 1 : $thickness; + $graph->add_edge($from => $to, penwidth => $thickness); } } $c->stash->{graphviz}->{graph} = $graph; |
