View Full Version : [4.0.0] Category axis labels for config.fields.length > 1 (Patch/override included)

27 Apr 2011, 9:46 AM
If you configure a Category axis with multiple fields declared in the fields: [] configuration, the labels configured for the axis are incorrect due to bad looping logic in setLabels.

As an example (that is somewhat contrived for simplicity), edit ext-4.0.0/examples/charts/GroupedBar.js and change the Category axis fields from ['name'] to ['name','name']. I would expect concatenation of the labels, instead of a label for each from each record. But regardless of what the actual intended results of that configuration are, the data in the chart no longer matches up to the axis. This makes sense with better data, where you have multiple fields that make up a label for a given record.

To match my own expectations, I have subclassed the category axis and used the following override:

setLabels: function() {
var store = this.chart.store,
fields = this.fields,
ln = fields.length,

this.labels = [];
store.each(function(record) {
var recordLabel = [];
for (i = 0; i < ln; i++) {
}, this);