Chartjs-Destroy multiple charts on same page

0👍

Ive had done some similar thing in the past, if i remember correcly, this is how i did it:

in controller

$scope.charts = [
    { 
        // chart 1 data
    },
    { 
        // chart 2 data
    }
]
$scope.removeChart = function(index) {
    $scope.charts.splice(index,1);
}

and html

<div ng-repeat="chart in charts track by $index">
    <!-- charts come here -->
</div>

if you remove chart from array of charts, it will also disappear from front view

Leave a comment