2014-09-20 91 views
0

我正在使用Chart.js添加餅圖。我可以顯示圖表,但想顯示標籤,百分比和圖例。向圖表添加標籤js餅圖

有誰知道如何做到這一點?

這裏是我是如何生成餅圖:

dashboardRegion: (survey) -> 
     male = 0 
     female = 0 
     survey.get('responses').each (response) -> 
     if response.get('completed') 
      if response.get('gender') == "male" 
      male += 1 
      else 
      female += 1 

     genderData = [ 
     { 
      value: male, 
      color:"#9A3334", 
      highlight: "#9A3334", 
      label: "Male", 
      labelFontFamily : "Arial", 
      labelFontStyle : "normal", 
      labelFontSize : 24, 
      labelFontColor : "#666" 
     }, 
     { 
      value: female, 
      color: "#217C7E", 
      highlight: "#217C7E", 
      label: "Female", 
      labelFontFamily : "Arial", 
      labelFontStyle : "normal", 
      labelFontSize : 24, 
      labelFontColor : "#666" 
     } 

     ]; 

回答