krispo / angular-nvd3

AngularJS directive for NVD3 reusable charting library (based on D3). Easily customize your charts via JSON API.
http://krispo.github.io/angular-nvd3
MIT License
1.29k stars 377 forks source link

Unable to disable legend based on another legend click #692

Open iranjith opened 7 years ago

iranjith commented 7 years ago

I am unable to disable legend based on the click of another legend in LineBar with focus chart. Below is the code which i am trying to achieve that which is not working in any of the events.

legend: {
                      "dispatch": {
                            legendClick:function(val,i){
                              console.log(val)
                            },
                            stateChange:function (val,i) {
                                if(val.disabled[1]==true){
                                    val.disabled[3]=true;
                                }
                             } 

                      },

In the legendClick event i am getting current legend item and in stateChange setting disabled to true for a specific legend is not working.

sowmith94 commented 6 years ago

You can use radioButtonMode in order to choose only one of the legend

legend": { "radioButtonMode": true }

hope it helps