0

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..

Graphileon
  • 5,275
  • 3
  • 17
  • 31
  • and what is not working? what says the console. put console.log(link) within the function. check this example for link styling: https://zoomcharts.com/developers/en/net-chart/examples/style/arrows.html – jancha Apr 09 '14 at 21:04
  • values for fillColor and radius are not applied. log shows this for a link with label "Benefits" http://snag.gy/MIXvM.jpg . Also checked this example https://zoomcharts.com/developers/en/net-chart/examples/style/colors.html . – Graphileon Apr 09 '14 at 21:49
  • what is strange that if I add the statement from the color example at the end of my own function, colors are applied .. – Graphileon Apr 09 '14 at 21:53

1 Answers1

1

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";
        }
Graphileon
  • 5,275
  • 3
  • 17
  • 31
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – рüффп Apr 09 '14 at 22:23
  • I am the author of the question :) – Graphileon Apr 09 '14 at 22:23
  • Then if you have resolved your problem, the right way is not to update the original question but to publish the solution as an answer. What you wrote here is more a comment not a real answer (solution), I suggest you post the correct code (including the break statements) in this answer. – рüффп Apr 09 '14 at 22:27