PDA

View Full Version : Chart yField increment



manilodisan
16 Nov 2013, 11:25 PM
I have this small chart that I display the number of online users with. If I have let's say 1 user online the left indicator shows 0, 0.4, 0.8, 1.2, 1.5, 2 with the bar sitting in the middle at 1. This incrementation is pretty wrong for my usage because there's no 0.8 online user or 1.5.

Is there a way I could control the increments myself?

Farish
17 Nov 2013, 1:43 AM
check out this example:

http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.chart.series.Column

if you change the data values in the store to 0s and 1s, then you will see that the y-axis shows 0s and 1s many times! I am also facing the same problem. To have only whole numbers on your axis, there is the following code in the example:


label: {
renderer: Ext.util.Format.numberRenderer('0,0')
},

if you comment this out, then it will appear as you are currently seeing i.e. you will see fractional values also. I am also looking for a solution to this problem.

manilodisan
17 Nov 2013, 5:15 AM
I think I solved it. You can try setting majorTickSteps to 0 in your axes

Farish
17 Nov 2013, 6:31 AM
this seems to work! I had set it to 1. I didn't find the description of this config in the documentation so clear. Also, no default value is mentioned.

thanks for the tip.

Farish
18 Nov 2013, 12:03 AM
this doesnt fix the problem completely because with majorTickSteps: 0, it only shows the maximum value label on the y-axis and no labels in between the minimum and maximum values. So if e.g. the number of users is 2, it will only show 0 and 2 on the axis. If its 50, it will show only 0 and 50 and no values in between the two.

From what I understood now is that majorTickSteps controls how many labels will be shown on an axis between the min and max values.