実際、レンダラー関数には、値だけでなく、さらに多くの引数が渡されます。これらの引数はメソッドと同じonPlaceLabel
ですが、先頭に値が追加されています。
index
シリーズにはフィールドの があり、実際のところseries
、引数にも がありますitem
。これで、私たちはあなたが望むものを達成することができます:
label: {
display:'insideStart'
,field:[null, null, 'drama', 'thriller']
,renderer: function(value, label, storeItem, item, i, display, animate, index) {
var series = item.series,
titles = series.title;
return titles && titles[index] || series.yField[index];
}
}
実際には、生のフィールド名をユーザーに表示しないため、最初にタイトルを取得しようとしています。記録のために、これを行うためにシリーズ全体を構成する方法を次に示します。ユーザーのコメントを除いて、ドキュメントには表示されません...
series: [{
type: 'bar',
axis: 'bottom',
gutter: 80,
xField: 'year',
yField: ['comedy', 'action', 'drama', 'thriller'],
title: ['Comédie', 'Action', 'Drame', 'Thriller'],
stacked: true,
label: {
display:'insideStart'
,field:[null, null, 'drama', 'thriller']
,renderer: function(value, label, storeItem, item, i, display, animate, index) {
var series = item.series,
titles = series.title;
return titles && titles[index] || item.yField;
}
}
}]