0

I am using angular-flot to draw a pie chart. But I can't element plotclick. I tried:

element.bind("plotclick", function (event, pos, item) {  
                if(item){
                    alert("Clicked");
                    scope.$apply();
               }
            });

But it is not being triggered.

This is my controller code:

$scope.dataset = [
          { label: "IE",  data: 19.5, color: "#4572A7"},
          { label: "Safari",  data: 4.5, color: "#80699B"},
          { label: "Firefox",  data: 36.6, color: "#AA4643"},
          { label: "Opera",  data: 2.3, color: "#3D96AE"},
          { label: "Chrome",  data: 36.3, color: "#89A54E"},
          { label: "Other",  data: 0.8, color: "#3D96AE"}
          ];
  $scope.options = {
    series: {
        pie: {
            show: true,
            radius: 1,
            label: {
                show: true,
                radius: 3/4,
                formatter: labelFormatter,
                background: {
                    opacity: 0.5,
                    color: '#000'
                }
            }
        }
    },
    legend: {
        show: false
    },

    grid: {
      hoverable: true,
      clickable: true
    }

So, do I have to change controller code or directive to implement click event.

Mmohits
  • 201
  • 1
  • 2
  • 10

1 Answers1

0

click the link use it. may helpful for you Click the Demo

Community
  • 1
  • 1
Angu
  • 862
  • 2
  • 13
  • 32