PDA

View Full Version : [FIXED-EXTJSIV-208] stacked bar chart axis not correct



marman
20 Mar 2011, 4:35 AM
Stacked bar charts do not appear render correctly. I have some code and to illustrate is dropped in a hardcoded data set. The sum of my elements is 210, but the bar draws all the way to the end of the axis which is 250.



Ext.require('Ext.chart.*');
Ext.require('Ext.layout.container.Fit');

Ext.onReady(function(){

var myPageSize = 7; // server script should only send back 25 items at a time

//--create the data store
var myStore = new Ext.data.Store({
model: 'ScheduleSummary'
,pageSize: myPageSize
});

var store = new Ext.data.JsonStore({
fields: ['dayId', 'loading', 'loaded', 'scheduled', 'updates', 'skipped', 'errors'],
data: [
{dayId: 2005, loading: 20, loaded: 20, scheduled: 30, updates: 40, skipped: 50, errors: 50},
{dayId: 2006, loading: 20, loaded: 20, scheduled: 30, updates: 40, skipped: 50, errors: 50},
{dayId: 2007, loading: 20, loaded: 20, scheduled: 30, updates: 40, skipped: 50, errors: 50},
{dayId: 2008, loading: 20, loaded: 20, scheduled: 30, updates: 40, skipped: 50, errors: 50}
]
});



var panel1 = Ext.create('widget.panel', {
width: 700,
height: 350,
title: 'Last 7 Days',
renderTo: 'scheduleFile-chart',
layout: 'fit',
items: {
xtype: 'chart',
animate: true,
shadow: true,
store: store,
legend: {
position: 'right'
},
axes: [{
type: 'Numeric',
position: 'bottom',
fields: ['loading', 'loaded', 'scheduled', 'updates', 'skipped', 'errors'],
title: false,
grid: true,
label: { renderer: Ext.util.Format.numberRenderer('0,0') },
}, {
type: 'Category',
position: 'left',
fields: ['dayId'],
title: false
}],
series: [{
type: 'bar',
axis: 'bottom',
gutter: 80,
xField: 'dayId',
yField: ['loading', 'loaded', 'scheduled', 'updates', 'skipped', 'errors'],
stacked: true,
tips: {
trackMouse: true,
width: 110,
height: 28,
renderer: function(storeItem, item){
this.setTitle(String( String(storeItem.get('dayId')) + ' : ' + String(item.value[1]) ) );
}
}
}]
}
});


//--manually load local data
myStore.loadPage(1);

});

Jamie Avins
25 Mar 2011, 8:36 AM
This has been fixed for the next release. There was also a related issue in Line and Scatter.