Actually, the renderer function is passed a lot more arguments than just the value. These arguments are the same as the onPlaceLabel method, with the value added to the beginning, and they are better documented there.
We've got the index of the field in the series and, as a matter of fact, we have the series also available in the item argument. With that, we can achieve what you want:
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];
}
}
I'm trying to get the title first because, in real life, I wouldn't display a raw field name to the user. For the record, here's how the whole serie would be configured in order to do that. It doesn't appear in the doc, except for a user comment...
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;
}
}
}]