2016-04-14 73 views
0

我遇到了我的Google PieChart pieSliceText位置問題。它重疊在頁面上,而不是完全在PieChart本身上。如何修改Google的PieChart pieSliceText定位

看到這個截圖照片:

enter image description here

我甚至調整了字體要小的多,但同樣的問題: enter image description here

由於波動的數據值和百分比的,我想避免調整'pieStartAngle'屬性,因爲我認爲它看起來很愚蠢。

有沒有辦法將「男」的標籤移動到餅圖上,而不是在「無人區」重疊?我希望這很容易(就像Google Bar Charts一樣),但事實並非如此。

這裏是我的圖表選項是什麼樣子:

var colors = ["#B5ACCE", "#61B036"]; //green and purple colors 

var data = google.visualization.arrayToDataTable([ 
    ['Type',  'Count'], 
    ['Male',  parseInt(_maleEnrollment)], 
    ['Female', parseInt(_femaleEnrollment)] 
]); 

//chart options 
var chartOptions = { 
    title: 'Gender' 
    ,pieSliceText: 'label' 
    ,pieSliceTextStyle: { color: 'black', fontName: 'Arial', fontSize: 20 } 
    ,colors: colors 
    ,backgroundColor: 'transparent' 
    ,legend: { textStyle: { color: 'black', fontName: 'Arial', fontSize: 14 } } 
    ,chartArea: { left: 0, 'width': '100%', 'height': '100%' } 
    ,enableInteractivity: false 
}; 

回答