0

I am doing a angular chart, which has three values and labels for the display, when i click the chart it must show the label which i clicked. I am trying to get the values from points.

 $scope.data = ["prospective","CallBacks","Closed"];
        $scope.labels = ["4","2","3"];
$scope.onClick = function (points,evt) {
    console.log("Points: "+JSON.stringify(points));
  $scope.struct=JSON.stringify(points);
  $scope.value=$scope.struct.label;
    }
<canvas id="pieChart" class="chart chart-pie"
     chart-data="data" chart-labels="labels" chart-legend="true" chart-click="onClick">
   </canvas>
<span>{{value}}</span>

Log show below Points:

[{"value":4,"outerRadius":95.5,"innerRadius":0,"fillColor":"rgba(151,187,205,0.8)","highlightColor":"rgba(151,187,205,0.8)","showStroke":true,"strokeWidth":2,"strokeColor":"#fff","startAngle":4.71238898038469,"circumference":1.9332877868244882,"label":"Prospective","_saved":{"value":4,"outerRadius":95.5,"innerRadius":0,"fillColor":"rgba(151,187,205,1)","highlightColor":"rgba(151,187,205,0.8)","showStroke":true,"strokeWidth":2,"strokeColor":"#fff","startAngle":4.71238898038469,"circumference":0,"label":"Prospective"},"endAngle":6.645676767209178}]

I can get values from log but which use the same in $scope.value the label is showing as undefined.

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555
Om Bala
  • 169
  • 3
  • 18

1 Answers1

0

Thanks for the support guys, There were array of json it seems so when i give $scope.value=$scope.struct[0].label is working perfectly..

Om Bala
  • 169
  • 3
  • 18