gooner
gooner

Reputation: 59

Accessing Hide/Unhide data series functionality of chart js using Angular 2

I am currently using PrimeNG charts built on top of chartJS.

The use case I am trying to implement is hiding/unhiding a particular data series using an external button.

Currently we can do this by clicking on the label of the corresponding data series.

Could someone point me in the right direction?

Upvotes: 0

Views: 416

Answers (2)

Ha Doan
Ha Doan

Reputation: 135

Currently we can do this by clicking on the label of the corresponding data series.

Do you know which javascript method of PrimeNG handle it? If yes, you should call the method that PrimeNG call in button click handler.

Upvotes: 0

Pedro Yan Ornelas
Pedro Yan Ornelas

Reputation: 851

You could do something like:

On HTML:

<div ng-hide="myCondition">
      ... content you wanna hide
<div>
<button ng-click="hidePanel()">HIDE</button>

And on your javascript

$scope.hidePanel = function (){
    $scope.myCondition = false;
}

Dont forget to initiate the value myCondition as true on the begining of the Javascript, otherwise ng-Hide wont function properly

Upvotes: 1

Related Questions