You found a bug! We've classified it as EXTJS-6103 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium Member
    Join Date
    Oct 2011
    Posts
    3
    Vote Rating
    2
    EJ.Beauchamp is on a distinguished road

      0  

    Default 4.0.7 & 4.1 - Ext.chart.series.Bar renderer returns incorrect record when stacked

    4.0.7 & 4.1 - Ext.chart.series.Bar renderer returns incorrect record when stacked


    Looking at the code, drawSeries is looping through the items in the chart, and calling:

    Code:
    me.renderer(sprite, store.getAt(i), barAttr, i, store)
    When using a stacked barchart, where 2 items are displayed per record, leaves 4 items in the chart and only 2 in the store.


    Example:

    Code:
    var myStore = Ext.create('Ext.data.Store', {
    fields: ['name', 'a', 'b'],
    data : [
    {'name': 'First', 'a':10, 'b':20},
    {'name': 'Second', 'a':15, 'b':15}
    ]
    }); 
    
    var chart = Ext.create('Ext.chart.Chart', {
    animate: true,
    style: 'background:#fff',
    shadow: true,
    width:193,
    height:200,
    renderTo: Ext.getBody(),
    store: myStore,    
    axes: [{
    type: 'Numeric',
    position: 'bottom',
    fields: ['a', 'b']
    }, {
    type: 'Category',
    position: 'left',
    fields: ['name']
    }],
    series: [{
    type: 'bar',
    axis: 'bottom',
    xField: 'name',
    yField: ['a', 'b'],
    stacked: true,
    renderer: function(sprite, record, attr, index, store) {
    console.log(index);
    console.log(record);
    return Ext.apply(attr, {});
    }
    }]
    });‚Äč
    Temporary fix:

    Code:
    rendererAttributes = me.renderer(sprite, items[i].storeItem, barAttr, i, store);
    and
    Code:
    rendererAttributes = me.renderer(sprite, items[i].storeItem, Ext.apply(barAttr, { hidden: false }), i, store);

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Vote Rating
    851
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Thanks for the report.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1