2017-04-10 62 views
0

在此圖像中,可以看到,在文本換行:
Line wrap active on visualization bar chart防止線纏繞在可視化的條形圖

如何預防呢? 此圖表的代碼是:

var data = google.visualization.arrayToDataTable(courseprogressdata); 

var options = 
{ 
    title: 'Progresso do curso', 
    chartArea: 
    { 
     width: '50%' 
    }, 
    legend: { 
     position: 'none' 
    }, 
    chart: 
    { 
     subtitle: 'com valores de 0 a 1' 
    }, 
    hAxis: 
    { 
     minValue: 0, 
     ticks: [0, 0.2, 0.4, 0.6, 0.8, 1.0], 
     format: 'percent' 
    }, 
    bar: 
    { 
     groupWidth: "90%" 
    }, 
    cssClassNames: 
    { 
     headerCell: 'googleHeaderCell' 
    } 
}; 

var chart = new google.visualization.BarChart(document.getElementById('courseprogresschart')); 

chart.draw(data, options); 

courseprogress是與此數據的數組:

"[["curso","progresso",{"type":"string","role":"annotation"}], 
["PJU",0.7893,"78.93%"], 
["Fundgest-GRHN1A",0.1427,"14.27%"], 
["asdzxc2",0.0387,"3.87%"]]" 

[編輯]我注意到換行只發生在Firefox ... 在鉻,一切都OK了,請參閱:
Line wrap on chrome are disabled

和公正的更多信息,googleHeaderCell CSS的內容是:

.googleHeaderCell {} 

回答

0

你可以使用下面的選項...

annotations: { 
    alwaysOutside: true 
} 
+0

我認爲這是唯一的解決辦法... – Bielcito

+0

好看多了,不是很理想,唯一的其他選擇是莫名其妙地調節軸最小值以確保有足夠的空間 - 但調整到小於零也不好 - 或使圖表變寬等... – WhiteHat