[英]Flot: Consistent label colors throughout screen with multiple stacked bar charts
[英]How to give solid colors to bar charts in flot
首先,閱讀API.txt ,它會回答您的所有問題。 那么你需要做兩件事。 當您指定要條形時,請設置fill: 1
,它告訴flot使顏色100%不透明。 要為每個系列指定顏色,只需為每個數據對象添加一個color:'red'
。
所以你最終會得到一個像這樣的數據對象:
var data = [
{label: 'foo', color:'red', data: [[1,300], [2,300], [3,300], [4,300], [5,300]]},
{label: 'bar', color:'blue', data: [[1,800], [2,600], [3,400], [4,200], [5,0]]},
{label: 'baz', color:'yellow', data: [[1,100], [2,200], [3,300], [4,400], [5,500]]},
];
像這樣的flot選項:
{
series: {
stack: 1,
bars: {
show: true,
barWidth: 0.6,
fill:1
}
}
}
在這里看到它: http : //jsfiddle.net/ryleyb/kKdxt/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.