PDA

View Full Version : How to avoid percentage values for Numeric Axis



jinionnet
8 May 2012, 10:56 PM
Hi Guys,
I have created a line chart with Numeric axis. When my Numeric axis value less than 10 it is splits to decimal value and I have to display some "Count" values in Numeric axis so it is absolutely nonsense. So I am finding a solution to avoid this decimal rendering for my chart. Please help me to resolve this issue. Or is it a Ext 4.1 native bug?

Here is my graph config



Ext.applyIf(me, {
axes: [
{
type: 'Category',
fields: [
'enrolled_date'
],
label: {
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
position: 'bottom',
title: 'Registered Date',
calculateCategoryCount: false
},
{
type: 'Numeric',
fields: [
'count'
],
position: 'left',
title: 'No of Mothers',
minimum: 0
}
],
series: [
{
type: 'line',
xField: 'enrolled_date',
yField: [
'count'
],
fill: true,
smooth: 3
}
]
});




Also my JSON data is as follows




[{"enrolled_date":"2012-04-21 00:00:00","count":"1"},{"enrolled_date":"2012-04-29 00:00:00","count":"5"},{"enrolled_date":"2012-04-30 00:00:00","count":"1"},{"enrolled_date":"2012-05-03 00:00:00","count":"1"}]



And my graph screen shot

34937


thanks in advance,
Jini

Farish
9 May 2012, 4:50 AM
try setting the field in your store model to type: 'int'.

jinionnet
9 May 2012, 11:38 PM
Hi Farish,
I am using int type already. Please have a look :



Ext.define('MB.model.ChartDatewise', {
extend: 'Ext.data.Model',


proxy: {
type: 'ajax',
url: 'jsondata.php?TYPE=CHART_REG_DATE_WISE',
reader: {
type: 'json',
root: 'chart'
}
},


fields: [
{
dateFormat: 'Y-m-d H:i:s',
mapping: 'enrolled_date',
name: 'enrolled_date',
type: 'date'
},
{
mapping: 'count',
name: 'count',
type: 'int'
}
]
});

Farish
10 May 2012, 12:51 AM
hmmm. then no idea. what i can suggest is that you use a trick with the renderer for the label for this axis. If this an integer value, show the same, if its non-integer, render nothing. this is just a workaround. give it a try.

jinionnet
10 May 2012, 1:34 AM
Farish, I have tried that too but the problem is it will result to an invalid behavior like multiple entries/points for numeric axis.