Chartjs-How to add Dyamic JSON Dropdown Menu in Angular JS

0πŸ‘

βœ…

I am not sure at all about what do you want to do, but I thing that you want a select with the labels and if you click on a label then the chart displays the values of the label, right?

<select ng-options="item as item.label for item in visits" ng-click="changeValues()" ng-model="selected"></select>

And then create the function in you controller

$scope.changeValues() {
    // You have the selected label in $scope.selected, so you have to iterate
    // over the visits array and then set the data where label == $scope.selected in the chart values
}

I can’t test it right now but I hope that the idea helps you to solve the issue.

Leave a comment