[Interop-dev] RFC: add parameter link-type

Nemesis (spam-protected)
Sun Aug 30 14:06:03 CEST 2015


On 08/28/2015 02:04 PM, Bastian Bittorf wrote:
> * Nemesis <(spam-protected)> [28.08.2015 13:49]:
>>> this will not work, because one node can have different interfaces with
>>> different types - how can i add that to properties?
>> Link objects can have properties too!
> oh - soooo easy?! thank you:
> http://intercity-vpn.de/networks/giancarlo/meshrdf/netjson.html
> (mixed wireless+ethernet)
>
> next week i will implement the subtypes. (frequency + channelwidth)


Well I found out a few things to change in networkgraph to allow
customizing colors more easily.

For the moment try this crappy hack:

add style in your <head>:

    <style>
        .ethernet,.ethernet:hover,.ethernet.njg-open { stroke: rgb(230,
85, 13) !important }
        .ethernet{ stroke-opacity: 0.5 }
    </style>

and in <script>:

    <script>
        d3.netJsonGraph("map.json");
        setTimeout(function(){
            d3.selectAll('.njg-link').attr('class', function(l){
                if (l.properties && l.properties.type) {
                    return 'njg-link ' + l.properties.type;
                }
                return 'njg-link';
            });
        }, 500);
    </script>


We need 2 things in netjsongraph.js:

  * a parameter that accepts a function to be executed when the graph
    has finished loading data
  * when clicking on a node or a link right now the library hardcodes
    "njg-link njg-ethernet", deleting any custom added class .. so if
    you click on the ethernet links you will lose the color!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.funkfeuer.at/pipermail/interop-dev/attachments/20150830/433b1c1a/attachment.html>


More information about the Interop-dev mailing list