PDA

View Full Version : NaN labels in numeric axis



da_b0uncer
8 Apr 2013, 8:06 AM
I have a numeric y-axis, which only shows NaN values.



{
"title":"Sessions",
"description":"",
"position":"left",
"type":"numeric",
"fields":["ts"],
"format":"0,000",
"minimum":0
}


The ts field is configured as float in the model.

When I look in the store all data gets parsed right, but when I look in the drawLabel method of the numeric axis, there are no labels. the renderer always gets "undefined".

slemmon
9 Apr 2013, 9:09 PM
Is the data field used by the axis configured as type: number?

da_b0uncer
9 Apr 2013, 11:56 PM
I've overriden the numeric axis constructor with this:


constructor: function() {
this.callParent(arguments);
console.log(this);
}

It shows something like this:
fields pointing to "ts" and "ts" being parsed as a number field (float) in the model objekt of the store.



fields: [
"ts"
],
chart: {
store: {
data: {
items: [
{
data: {
ts: 123
month: "january"
}
}
]
}
}
}

Farish
10 Apr 2013, 12:03 AM
Luckily, its just a small mistake in your code. All you need to do to fix it is to replace the 'numeric' with 'Numeric'! The type is case sensitive. This effect can also be observed if you change Numeric to numeric in the example code in the API docs:

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.chart.axis.Numeric

da_b0uncer
10 Apr 2013, 12:08 AM
Sadly it's not, since I have overriden the Numeric class and redefined the alias :\

Farish
10 Apr 2013, 12:12 AM
then it could be because of something in the override. Its difficult to say.

da_b0uncer
10 Apr 2013, 12:25 AM
Hum... you were right. When I wrote Numeric and used the original class, it worked.

Funny thing is, the "new" class doesn't do anything new ATM (but it should after I got this working) just redefining the alias.

da_b0uncer
10 Apr 2013, 12:36 AM
Probably there is an explicit dependency on the Ext.chart.axis.Numeric class anywhere in the chart code, which breaks the whole thing :\

da_b0uncer
10 Apr 2013, 12:47 AM
The redefinition of the axis. alias is the problem.

If I define the alias of my new class like the old one (axis.Numeric) it works

But if I define it as "axis.number" it doesn't

Also if I define the alias of Ext.chart.axis.Numeric as "axis.number" it doesn't work.

Somehow the alias is used somewhere to determine behaviour :\