extjs4.2 - ExtJS displaying field name inside chart -


consider following example of stacked bar chart. can display count of each of fields (comedy, action, drama, thriller) in bars adding label config in series, how display field name?. renderer config property label doesn't seem of use function receives count argument.

label:{   display:'insidestart'  ,   field:[null, null, 'drama', 'thriller'],   renderer:function(item){     //for case, item int value. thus, not sure how useful      //as cannot field name it.   }           } 

actually, renderer function passed a lot more arguments value. these arguments same onplacelabel method, value added beginning, , better documented there.

we've got index of field in series and, matter of fact, have series available in item argument. that, can achieve 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 title first because, in real life, wouldn't display raw field name user. record, here's how whole serie configured in order that. doesn't appear in doc, except 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;         }     } }] 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -