PDA

View Full Version : Incorrect values ??on the Y axis - Charts



fabio.policeno
15 Feb 2013, 1:38 AM
Hello, I have problem in the code below:


var store = Ext.create('Ext.data.Store', {
fields: ['option', {name: 'votes', type: 'int'}],
data : [{"votes":1,"option":"4"},{"votes":5,"option":"3"},{"votes":4,"option":"2"},{"votes":3,"option":"1"}],
proxy : {
type : 'memory',
reader: {type: 'json'}
}
});


Ext.widget('chart', {
renderTo: Ext.getBody(),
height : 500,
width : 500,
store : store,
axes : [{
type : 'Numeric',
title : 'Votes',
position: 'left',
fields : ['votes']
},{
type : 'Category',
title : 'Options',
position: 'bottom',
fields : ['option']
}],
series: [{
type : 'column',
yField : 'votes',
xField : 'option'
}]
});


The Y axis should not start at 0 for the bar that was displayed (votes: 1, option 4 - the bar with value 1 is not being displayed. Which problem?)?

And the value of axes Y need have int and no float, no?

Here the picture: http://cl.ly/image/2e1Y0l2y1d0l

Thank's!

fabio.policeno
15 Feb 2013, 5:47 AM
I use the version 4.1.0, I realized that running v4.1.3 on the axis starts with 0. Someone already has an override for this? Meanwhile I will try to develop one.

Farish
15 Feb 2013, 5:48 AM
To solve your first problem, if you add minimum: 0 to your votes axis, it will show the first bar:


axes : [{
type : 'Numeric',
title : 'Votes',
position: 'left',
minimum: 0,
fields : 'votes'

},{
type : 'Category',
title : 'Options',
position: 'bottom',
fields : 'option'
}],

I dont know how you can make the axis show integer values only. The behavior seems to have changed in the new ExtJS versions.

fabio.policeno
15 Feb 2013, 6:44 AM
My fault, I had tried in v4.1.0, but with a variable name wrong, just not working and not realized. Thank's