Styling links according to link.label in zoomcharts library

174 Views Asked by At

Trying to style links ..

chart has

        linkRules:{"rule1":linkStyle},

and function defined as such

        function linkStyle(link){
            switch (link.label)
            {
            case "Executes": 
                link.fillColor = "blue";
                link.radius = 4;

            case "Benefits": 
                link.fillColor =  "green";
                link.radius = 2;

            default:
                link.fillColor = "#000000";
                link.radius = 1;
            };
            link.toDecoration="arrow";
        }

but not working as expected..

1

There are 1 best solutions below

3
On BEST ANSWER

Got it :) I overlooked to include the "break;" statement and the end of each case.

        function linkStyle(link){
            switch (link.label)
            {
            case "Executes": 
                link.fillColor = "blue";
                link.radius = 4;
                break;  
            case "Benefits": 
                link.fillColor =  "green";
                link.radius = 2;
                break;  
            default:
                link.fillColor = "#000000";
                link.radius = 1;
            };
            link.toDecoration="arrow";
        }