Display (Show) Legend in Pie Chart using ChartJS in AngularJS

Last Reply 3 months ago By dharmendr

Posted 3 months ago

Legend not showing in pie chart using chart.js in angularjs

<script src="http://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js"></script>
<canvas id="pie" class="chart chart-pie" data="pieDiskData.data" labels="pieDiskData.labels" width="245%" colours="pieDiskData.colours"></canvas>                        
    $scope.dd = null;
    $http.get(apiUrl + "/api/Warehouse/GetDashboardDays")
    .then(function (response) {
        $scope.dd = JSON.parse(response.data);
        $scope.quantity1 = $scope.dd[0].Qty;
        $scope.quantity2 = $scope.dd[1].Qty;
        $scope.quantity3 = $scope.dd[2].Qty;
        $scope.quantity4 = $scope.dd[3].Qty;           
        var diskDataJson = {
            "data": [$scope.quantity1, $scope.quantity2, $scope.quantity3, $scope.quantity4],
            "labels": ["0-30 days", "31-60 days", "61-90 days", "91 days & above"],
            "colours": ['#36a2eb', '#ff6384', '#cc65fe', '#ffce56']
        $scope.pieDiskData = diskDataJson;        


This question does not have replies that have been liked.