mardi 1 septembre 2015

How do i access label text in piechart created using D3.js?

I am accessing label text in piechart like this

if($scope.data[0].label === 'Successful  Calls')
    {
        buildChart("#chart1", $scope.data);
    }
    else
    {
        buildChart("#chart2", $scope.data);
    }

its working fine but when i run test cases written in parent directive gets failed.If i remove if else block then tests are passing. this error i got

 TypeError: 'undefined' is not an object (evaluating '$scope.data[0]')

can i access the label text using some other method because ,method i using already creating problem for test cases.

Aucun commentaire:

Enregistrer un commentaire