PDA

View Full Version : Issue with Bar chart when value is set to zero



divyangowda
28 May 2013, 4:36 AM
Hi,
I am using bar chart in my application, when store which is mapped for this chart is zero, In firefox chart is not visible and there is an alignment issue in IE and Chrome.

Thanks for your help.

friend
28 May 2013, 5:15 AM
Are you saying that your data store is empty? Or that one or more rows in the store have a zero value?

divyangowda
29 May 2013, 4:26 AM
Hi,
Thanks for your reply.
Store is not empty, but all rows of store has zero values. i am using extjs 4.0.7 version.

my store contains only 2 filelds 'age' and 'count', i am getting issue when all rows for count contains zero value.
fields: [
{ name: 'age', type: 'string' },
{ name: 'count', type: 'string' }
]


Following is the code which i used to generate the Bar chart
xtype: 'chart',
animate: true,
//autoSize: true,
autoShow: true,
store: chartStore,
theme: 'CSI:gradients',
width: 438,
height: 200,
legend: false,
style: {
border: 0,
padding: 0
},
background: {
//color string
fill: '#fff'
},
axes: [{
type: 'Category',
position: 'left',
fields: ['age'],
title: '',
grid: true,
label: {
renderer: Ext.util.Format.numberRenderer('0,0')
},
minimum: 0
}, {
type: 'Numeric',
fields: ['count'],
title: '',
position: 'bottom',
grid: true

}],
series: [{
type: 'bar',
axis: 'bottom',
highlight: true,
tips: {
trackMouse: true,
width: 140,
height: 28,
renderer: function(storeItem, item) {
this.setTitle('#' + storeItem.get('count') + ' orders');
}
},
label: {
display: 'insideEnd',
field: 'count',
renderer: Ext.util.Format.numberRenderer('0'),
orientation: 'horizontal',
color: '#fff',
'text-anchor': 'middle'
},
xField: 'age',
yField: 'count'
}],

Farish
29 May 2013, 4:45 AM
it seems to be a bug. I tried it in the examples in the API docs. when all values are zero, the chart is not rendered properly in ExtJS 4.0.7 but works fine in 4.2.0

divyangowda
11 Jun 2013, 6:50 AM
is there any possible solution to fix this issue in 4.0.7 version